[Python Patterns] Flask boilerplate app - UPDATED

The purpose of this repo is to build a simple boilerplate for my apps to deploy web ideas quickly.

GitHub - BitsofJeremy/flask_app_boiler
Contribute to BitsofJeremy/flask_app_boiler development by creating an account on GitHub.


Flask Setup for expansion via MVC

  • Default site pages controlled with Flask Blueprints [app/home folder]
  • Authentication built in [app/auth folder].
  • DB controlled by SQLAlchemy [SQLite by default]

Bootstrap Themes via Bootswatch CDN


git clone https://gitlab.com/abvavgjeremy/flask_app_boiler.git
cd flask_app_boiler
virtualenv -p python3 venv
source venv/bin/activate
pip install -r requirements.txt

export FLASK_APP=run.py
export FLASK_CONFIG=development

[Note: See an example .env file below]

source .env

Use manage.py script to work with the system:

Create the DB

python manage.py --create_db

Create an admin user
[note: edit manage.py admin example user]

python manage.py --create_admin

Drop the DB tables, if you need to start over

python manage.py --drop_db

Run it

python run.py

Open in browser of choice.

Connect to the API for the Swagger interface.


Example .env file

# Basic Flask stuff
export FLASK_APP=run.py
export FLASK_CONFIG=development

# DB Stuff

# Admin info
export ADMIN_USER=admin
export ADMIN_PASSWORD=super_secret
export ADMIN_EMAIL=admin@example.com

# Secrets
# Default: MD5 of "secret"
export SALTY_SECRET=5ebe2294ecd0e0f08eab7690d2a6ee69