Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Flask application generator for boosting your development.

Project Description

Flask application generator for boosting your development.

Features

  • Well Defined Project Structure
    • Use factory pattern to generate Flask app.
    • Use Blueprints to organize controllers.
    • Split controllers, models, forms, utilities, assets, Jinja2 pages, Jinja2 macros into different directories.
    • Organize Jinja2 page assets (HTML, JavaScript, CSS) to the same directory.
    • Organize Jinja2 macro assets (HTML, JavaScript, CSS) to the same directory.
  • Batteries Included
    • Use Flask-SQLAlchemy and Flask-Migrate as database tools.
    • Use Flask-WTF to validate forms.
    • Use Flask-Script to help writing scripts.
    • Use permission to define permissions.
    • Use Bootstrap as frontend framework.
    • Use bower manage frontend packages.
    • Use Gulp and FIS to compile static assets.
    • Use Gunicorn to run Flask app and Supervisor to setup Gunicorn processes.
    • Use Fabric to deploy app.
    • Use Sentry to track exceptions.
    • Use Nginx to serve static files.
  • Scaffold Commands
    • Generate project files: boost new <project>
    • Generate controller files: boost new controller <controller>
    • Generate action files: boost new action <controller> <action> [-t]
    • Generate form files: boost new form <form>
    • Generate model files: boost new model <model>
    • Generate macro files: boost new macro <category> <macro> or boost new macro <macro>

Installation

pip install flask-boost

or install the latest version from GitHub:

pip install git+https://github.com/hustlzp/Flask-Boost.git#egg=flask_boost

ATTENTION: Breaking changes have been made in 0.6.x, use the command below if you want to install the 0.5.x version:

pip install flask-boost==0.5.6

Development Guide

Init project

boost new <your_project_name>

Setup backend requirements

cd to project root path, run:

virtualenv venv
. venv/bin/activate (venv\Scripts\activate in Windows)
pip install -r requirements.txt

Note: if you failed in pip install -r requirements.txt in Windows, try to install package binaries directly:

Init database

Create database with name your_project_name and encoding utf8.

Update SQLALCHEMY_DATABASE_URI in config/development.py as needed.

Then init tables:

python manage.py db upgrade

Run app

Run local server:

python manage.py run

Setup frontend requirements

Install Node.js first and then install Bower, FIS and Gulp globally:

npm install -g bower
npm install -g fis
npm install -g fis-postpackager-simple
npm install gulp

Install local packages:

npm install
bower install

Run Gulp watch task

gulp watch

LiveReload support

Install LiveReload browser extension from here.

And use python manage.py live instead of python manage.py run to start app.

Scaffold commands

boost new <project>
boost new controller <controller>
boost new action <controller> <action> [-t]
boost new form <form>
boost new model <model>
boost new macro <category> <macro>
boost new macro <macro>
boost -v
boost -h

First Production Deploy

Config server

Install virtualenv, git, supervisor, nginx and g++ on your server.

Note: Flask-Boost uses Pillow to process images, so you may install some external libraries needed by Pillow. Please follow the Pillow official doc.

Install requirements

git clone **.git
cd proj
virtualenv venv
. venv/bin/activate
pip install -r requirements.txt

Config app

Update configs in config/production.py as needed and transfer it to server.

Note: remember to update SECRET_KEY in config/production.py! You can generate random secret key as follows:

>>> import os
>>> os.urandom(24)

Init database

Create database with name your_project_name and encoding utf8.

And run:

export MODE=PRODUCTION
python manage.py db upgrade

Copy config files

Update project root path as needed in deploy/nginx.conf and deploy/supervisor.conf.

cp deploy/flask_env.sh /etc/profile.d/
cp deploy/nginx.conf /etc/nginx/conf.d/<your_project_name>.conf
cp deploy/supervisor.conf /etc/supervisor/conf.d/<your_project_name>.conf

Build assets

Install Node.js first and then install Bower, FIS and Gulp globally:

npm install -g bower
npm install -g fis
npm install -g fis-postpackager-simple
npm install -g gulp

Install local packages:

npm install
bower install

Then:

gulp
python manage.py build

Start app

service nginx restart
service supervisor restart

for CentOS 7:

systemctl start nginx.service
systemctl start supervisord.service

Daily Production Deploy

Update HOST_STRING in config with the format user@ip.

Commit your codes and run:

git push && fab deploy

License

The MIT License (MIT)

Release History

Release History

This version
History Node

0.7.5

History Node

0.7.4

History Node

0.7.3

History Node

0.7.2

History Node

0.7.1

History Node

0.7.0

History Node

0.6.4

History Node

0.6.3

History Node

0.6.0

History Node

0.5.6

History Node

0.5.5

History Node

0.5.4

History Node

0.5.3

History Node

0.5.2

History Node

0.5.1

History Node

0.5.0

History Node

0.4.18

History Node

0.4.17

History Node

0.4.16

History Node

0.4.15

History Node

0.4.14

History Node

0.4.13

History Node

0.4.12

History Node

0.4.11

History Node

0.4.10

History Node

0.4.9

History Node

0.4.8

History Node

0.4.7

History Node

0.4.6

History Node

0.4.5

History Node

0.4.4

History Node

0.4.3

History Node

0.4.2

History Node

0.4.1

History Node

0.4.0

History Node

0.3.4

History Node

0.3.3

History Node

0.3.2

History Node

0.3.1

History Node

0.3.0

History Node

0.2.0

History Node

0.1.7

History Node

0.1.6

History Node

0.1.5

History Node

0.1.4

History Node

0.1.3

History Node

0.1.2

History Node

0.1.1

History Node

0.1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
Flask-Boost-0.7.5.tar.gz (591.3 kB) Copy SHA256 Checksum SHA256 Source Dec 11, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting