This repository contains a sample minimal Flask application structure that includes:
- SQLAlchemy
- Alembic
- Celery
- Pytest
- Coverage
It runs on Python 3.x
First, clone the repository and create a virtualenv. Then install the requirements:
$ pip install -e .
Before running the application make sure that your local PostgreSQL server is up. Then create the databases:
CREATE DATABASE flask_example;
CREATE DATABASE flask_example_test;Now you can create the tables using Alembic:
webapp db upgradeFinally you can run the application:
webapp runserveror play in the Python REPL:
webapp shellIn order to run unit tests in py.test invoke:
webapp testTo view test coverage:
webapp coverageThere is a preconfigured WSGI module located at webapp.core.wsgi. Example usage with Gunicorn:
gunicorn --workers 1 --bind 0.0.0.0:8000 webapp.core.wsgi:applicationIf the process fails to start, try prepending the gunicorn with its relative path within your virtual environment, for example env/bin/gunicorn ...