Initial scaffolding for a flask rest API development. Starter template for building your Flask and Flask Rest API applications.
- Gunicorn server setup
- Database migration setup for SQLAlchemy Models
- JWT authentication at
<your-host>/api/v1/login - Url to register your admin and users at
<your-host>/api/v1/signup - Provisioned route file for all your routes with admin blueprints
- Test environment setup
This App was developed with the following stack:
- Python==3.12
- Flask==3.10
- Flask-restful==0.3.10
- Flask-Script==2.0.6
- Flask-SQLAlchemy==3.1.1
- Postgres DB / SQlite
- Gunicorn Web Server
- Python 3.12+
- Python pip
- Postgres / SQlite
- fork this repository
- create a .env file as shown in the env_example file
- setup your database
- on the terminal cd into the app folder
- run
pip install -r requirements.txtto install required modules - run
flask --app manage db initto setup alembic migrations - run
flask --app manage db migrate -m='<your migration message>'to create migration files - then run
flask --app python manage db upgradeto create tables
- on the terminal run
gunicorn main:app - To run app on a specific port use
gunicorn -127.0.0.1:port main:app
src/api/resources--- flask-restful resources for your projectsrc/models--- SQLAlchemy models and schemasrc/routes/api--- contains all your route definitionsrc/utils--- contains validations, security and helper filessrc/middlewares--- define your middleware files here- You can modify the app to suit your need.
- Happy usage.
- Flask-JWT has been replaced with Flask-JWT-extended
- Flask-Scripts and dependencies removed.
- Future versions may use Pydantic instead of Marshmallow
- Contributors are needed to keep developing this template with updates to its dependencies. You can reach me on my email.