Flask Boilerplate Project
Introduction
I wanted a super-quick way to create new websites with all my favorite code settings and customizations. Hence, I created this boilerplate project based on the Flask (Python) microwebframework.
Why Flask-Boilerplate? Because you get:
- Good code defaults β for example, (1) it uses packages and modules by default so that controllers and models are organized into a standard directory structure and split into multiple files, (2) it merges and compresses your various CSS files into one, your multiple JS files into one, for performance reasons. And so on.
- New Project script β sets up everything for you right from generating the secret key (for secure cookies) to integrating memcache (including mimicing
Rails.cache.fetch
with helpers). - Deploy to a Ubuntu server with a single command β sets up everything for you, including
virtualenv
, etc.- NOTE: The installation script works specifically for Ubuntu Linux, Apache, mod_wsgi only.
- jQuery β no webapp is complete without it.
- Grid system, via the 960 Grid System β so that you can get started with your UI quickly.
- HTML5 goodness, via HTML5 Boilerplate β for a good base UI.
Get Started
git clone git://github.com/swaroopch/flask-boilerplate.git mynewapp
cd mynewapp
pip install Fabric
fab code_init:mynewapp.com
fab env_setup
Write your code in flask_application/controllers/frontend.py
fab server
When youβre ready to deploy your code to a server:
fab server_setup
# once per server
fab deploy
When you clone a repo and want to run it:
fab env_setup
fab server
Also See
- Mobile browser detection to redirect users to a version of the website that uses the Mobile HTML5 Boilerplate.
- API wrapper like simpleapi.