Flask-Seed is an opinionated boilerplate for your next Flask app. It uses the best practices, so you don't have to.
- Built in Flask
- Flask-Mongoengine and Mongoengine are used to interface with MongoDB
- Forms and validation are done through Flask-WTForms and WTForms
- CSS is generated from SCSS and managed with Flask-Assets
- Routing is done using Blueprints
- Testing is done using
nosetests
andunittest
.
Flask-Seed runs natively on Linux and OSX in a virtual environment, using Virtualenv. To get it up an running, follow these steps:
-
Generate secrets files, using good secret keys:
cp config/example.secrets.py config/secrets.py vim config/secrets.py
-
Change all the
CHANGEME
s. You should be able to run this command without seeing any output:grep -rn CHANGEME .
-
Install MongoDB (Ubuntu Linux, OSX).
On OSX, you may have to run
mkdir /data /data/db
before you can runmongod
without errors. -
Install VirtualEnv:
sudo pip install virtualenv
-
Install SASS gem
gem install sass
Otherwise, you will see an intermittent
OSError
./develop.sh # MongoDB, virtualenv, and Pip
source bin/activate # Enter the virtual environment
python run.py # Run the application
Finally, go to localhost:5000
in your web browser.
Tests live in the test
directory, and can be run via nosetests
. We also use flake8
for linting .py
files.
First, enter your development environment. See "Developing" for more. Then, run the tests:
flake8 app config test # Run the flake8 linter on our python files
nosetests --with-progressive # Run test scripts
.
├── app # All code related to the running of the app
│ ├── forms # Flask-WTForms models, used for generating forms in
│ │ # HTML and validating input
│ ├── lib # Misc helpers, tasks, and modular libraries
│ ├── models # Mongoengine Models
│ ├── routes # All Flask routes, using Blueprints
│ ├── static # Static files. Note: All files in here are public
│ │ ├── css # CSS
│ │ │ ├── lib # CSS libraries
│ │ │ └── gen # CSS generated from SCSS
│ │ ├── img # Images
│ │ ├── js # JavaScript files
│ │ └── scss # Stylesheets
│ ├── templates # HTML templates
│ └── __init__.py # All app-wide setup. Called by `run.py`
├── config # Configuration files
├── develop.sh # Used for non-Vagrant local Development
├── run.py # Runs the app!
└── test # Unit tests