Skip to content

Latest commit

 

History

History
94 lines (63 loc) · 1.62 KB

README.md

File metadata and controls

94 lines (63 loc) · 1.62 KB

Flask Minimum Boilerplate App

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.

Compatibility

Requires Python 3.9+.

Dependencies

Quickstart (Windows)

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

Docker

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

Improvements

  • Integrate ORM package/library
  • Cacheing
  • Alternative DB