Boilerplate for Flask Projects
For use with latest flask and python 3.6
- Find all the instances of #CHANGEME and add the name of your project.
- Optionally rename the app folder to be the name of your application.
- Create a new pipenv
pipenv --python 3.6
- Install python depenencies with
make deps
- Run your application using
make run
- Run tests with
make test
Handy Makefile to make all of the below dead simple.
This uses pipenv to manage dependencies.
The app directory contains code for your application.
The app uses the factory pattern.
Uses sphinx to generate documentation for a project.
Follow these steps to quickly get started:
cd docs
sphinx-quickstart
Enter the information for your project.
If you want to use the autodoc feature of sphinx be sure to update the generated conf.py
file and append the path to your source code.
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__name__), '..'))
Uses the built in unit test library in python to run tests. Has some boilerplate tests in place to get you started.
You can run the tests with make test
Uses the coverage library to create code coverage reports.
Code coverage happens automatically when you run the tests. To generate a report you can run coverage html
.
If you use CircleCI (below) then the coverage reports will be stored as artficats of your build.
Ready to go configuration for using python with CircleCI 2.0.
Ready to go Dockerfile for packaging up your application in a container.
Change the Makefile from #CHANGEME
to a name for your docker image. (i.e org/repo
)
You can then run make docker
to build the image and make docker-run
to run the image. You can go to localhost:5000
in your browser once its running to see your app.