Flask seed project...
- Install pipenv
$ pip install pipenv
- Create and activate virtual environment
$ cd <project_dir> $ pipenv shell
- Install python packages
$ pipenv install $ pipenv install --dev
Set environment variables necessary to run Flask. NOTE: This is only necessary if executing flask directly and not through bootstrap.sh.
$ export FLASK_APP=autoapp.py
$ export FLASK_APP_CONFIG=local
NOTE: You will need to set these two environment variables every time you re-activate the shell
TODO: Implement something like python-dotenv
This will create an initial SQLite database based on latest migrations.
$ flask db upgrade
A bootstrap.sh BASH script has been created to help run the application.
Local with debug mode:
$ ./bootstrap.sh -e local -d
Prod using Gunicorn
$ ./bootstrap.sh -e prod -w
Flask click command (w/ coverage):
$ flask test
Pytest without coverage:
$ pytest
Pytest with coverage:
$ pytest --cov=app
Assuming your current shell has an activate virtual environment (denoted by something similar to (flask-seed-ETuCx1xA) within the shell), make sure to deactivate upon completion.
$ exit
Various custom click commands have been defined within the commands module. A full list of flask commands can be found by running...
$ flask --help
clean Remove *.pyc and *.pyo files recursively starting at current directory.
create_db Create initial database.
db Perform database migrations.
lint Lint and check code style with flake8 and isort.
run Runs a development server.
shell Runs a shell in the app context.
urls Display all of the url matching routes for the project.
$ flask urls
Rule Endpoint
----------------------------------
/api/v1/expenses/ api.v1.expenses
/api/v1/incomes/ api.v1.incomes