This is a simple Backend Rest API developed using python flask. The architecture of the codebase is highly maintainable. It has following functionalites:
- User registration
- User login
- List users (Admin only)
- Get current user details
- Generate JWT token
- Create Countries (Admin only)
- Get Countries
- Create Cities (Admin only)
- Get Cities
- Flask
- Flask SQL Alchemy
- Flask Marshmallow
- Marshmallow SQL Alchemy
- Flask Migrate
- Werkzeug
- Flask CORS
- Flask JWT Extended
Create project directory
mkdir flaskboilerplate
cd flaskboilerplate
- Python 3.7+
Run the following commands to create and activate a virtual environment named venv
(different name can be used)
python3 -m venv venv
. venv/bin/activate
Set flask app by running following command:
set FLASK_APP=app
export FLASK_APP=app
If wheel is not installed run the follwoing command to install it:
pip install wheel
To build distribution package run the following command:
python setup.py bdist_wheel
For the first time, run the following commands to create database schemas:
flask db init
flask db migrate
flask db upgrade
Replace x.x.x with the actual version name
pip install app-x.x.x-py3-none-any.whl
If waitress
is not installed run the following command to install it:
pip install waitress
If waitress
is already installed run the following command to run the application:
waitress-serve --call app:create_app