This is a personal blog CMS built using Flask, MongoDB, Marshmallow for serialization, and Swagger for API documentation.
- Uses Flask for the web framework.
- MongoDB for the database, with support for mongomock during testing.
- Marshmallow for data validation and serialization.
- API documentation using Swagger.
- Unit tests with pytest.
flask_cms/
|
├── app/
│ ├── controllers/ # Business logic and interaction with models
│ ├── docs/ # Swagger YAML files for API documentation
│ ├── helpers/ # Utility functions for reusability
│ ├── routes/ # Flask routes/endpoints
│ ├── schemas/ # Marshmallow schemas for serialization and validation
│ ├── services/ # MongoDB services
│ ├── __init__.py # Application factory, config, and database setup
|
├── tests/ # Unit tests
│ ├── conftest.py # Pytest fixtures for testing
|
├── config.py # Application configurations (development, testing, production)
├── requirements.txt # List of dependencies
├── .gitignore # Files and directories to be ignored by git
├── README.md # Project documentation
├── pytest.ini # Pytest configuration file
├── .env.example # Example environment variables file
- Python 3.x
- MongoDB
- Flask
- Virtual Environment (recommended)
- Install the dependencies:
pip install -r requirements.txt
- Set up environment variables by creating a
.env
file at the root:
FLASK_ENV=development
MONGO_URI=mongodb://localhost:27017/mydatabase
- Run the Flask application:
flask run
- Access the Swagger documentation at:
Unit tests are written using pytest and mongomock. To run the tests:
pytest -v
This project is licensed under the MIT License. See the LICENSE file for details.