Thos project is based on the Flask Tutorial, adapted to be a backend-only for the blog app.
- Docker - https://docs.docker.com/desktop/
- Docker Compose - https://docs.docker.com/compose/
- Miniconda - https://docs.conda.io/en/latest/miniconda.html
- Install Miniconda if not already installed;
- Create a Conda virtual environment with Python 3.10:
conda create -n blog python=3.10 -y
- Activate the environment and install the requirements:
conda activate blog; pip install -r requirements.txt
To run in your own machine (without Docker):
- Activate the Conda virtual environment (if not active already):
conda activate blog
- Synchronize the changes to the SQLite database:
flask db upgrade
- Run Flask:
flask --app app run --debug
- Access http://localhost:5000/apidocs
- Press Ctrl+C in the Terminal to quit Flask
- Run
docker compose up
to run the application - Access http://localhost:5000/apidocs
app
- __init__.py # main application file
- globals.py # global objects
- modules # each application module/route group
- user # user and authentication
- model.py # model definitions
- resource.py # routes
- post
- model.py
- resource.py
- instance
- blog.sqlite # SQLite database (not included in Git)
- migrations # database migration files
- ... # files generated by Flask-Migrate package
- Flask: https://flask.palletsprojects.com/en/2.3.x/
- Database:
- Flask-SQLAlchemy: https://flask-sqlalchemy.palletsprojects.com/en/3.0.x/
- SQLAlchemy: https://docs.sqlalchemy.org/en/20/
- Flask-Migrate (
flask db
commands): https://flask-migrate.readthedocs.io/en/latest/
- Serialization:
- Flask-Marshmallow: https://flask-marshmallow.readthedocs.io/en/latest/
- Marshmallow: https://marshmallow.readthedocs.io/en/stable/
- marshmallow-sqlalchemy: https://marshmallow-sqlalchemy.readthedocs.io/en/latest/
- Authentication:
- PyJWT: https://pyjwt.readthedocs.io/en/stable/
- Flask-HTTPAuth: https://flask-httpauth.readthedocs.io/en/latest/
- Development:
- Flasgger (
/apidocs
route): https://github.com/flasgger/flasgger
- Flasgger (