Flask Minimum Boilerplate is a minimal boilerplate for prototyping a backend appliation with Flask and python.
Features Flask-RESTX for Swagger support; Flask-JWT-Extended for JSON Web Token support; pytest and coverage for testing
This project is for educational purposes.
Requires Python 3.9+.
- Flask-RESTX
- Flask-JWT-Extended
- pytest
- coverage
Run python in virtual environemnt
py -3 -m venv venv
venv\Scripts\activate
Install the dependencies via pip
pip install flask-restx flask-jwt-extended pytest coverage
Set the environment variables
$env:FLASK_APP='myapp'
$env:FLASK_ENV='development'
$env:PYTHONPATH='<PATH\TO\THIS\BOILERPLATE>'
Initialize the sqllite3 database
flask init-db
Run the app
flask run
Swagger landing page
http://localhost:5000/api
Unit tests and coverage
pytest
coverage run -m pytest
coverage report
coverage html
Build the image
docker build -t myapp .
Run image in development mode
docker run -dp 5000:5000 -v "$(pwd):/app" -v "$(pwd)/instance:/app/instance" myapp
Open swagger landing page in browser
http://localhost:5000/api
- Integrate ORM package/library
- Cacheing
- Alternative DB