Fbone (Flask bone) is a Flask (Python microframework) template/bootstrap/boilerplate application, with best practices.
You can use it for
- learning Flask.
- kicking off your new project faster.
- Handle orm with SQLAlchemy.
- Handle web forms with WTForms.
- Implement user session management (signin/signout/rememberme) with Flask-Login.
- Implement reset password via email with Flask-Mail.
- Implement unit testing with Flask-Testing.
- Implement external script (initdb/testing/etc) with Flask-Script.
- Handle i18n with Flask-Babel.
- Well designed structure for large project.
- Quickly Deploy via mod_wsgi and fabric.
- Admin interface.
- Home-bake logger.
Pre-required:
- Ubuntu (should be fine in other linux distro)
- git
- pip
- fabric
- sqlite
- virtualenv
- apache + mod_wsgi
Clone.
git clone https://github.com/imwilsonxu/fbone.git fbone
virtualenv.
fab setup
Debug.
fab d
Open http://127.0.0.1:5000
, done!
Clone.
cd /var/www
git clone https://github.com/imwilsonxu/fbone.git fbone
sudo chown `whoami` -R fbone
vhost.
WSGIDaemonProcess fbone user=wilson group=wilson threads=5
WSGIScriptAlias /fbone /var/www/fbone/app.wsgi
<Directory /var/www/fbone/>
WSGIScriptReloading On
WSGIProcessGroup fbone
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
virtualenv.
fab setup
IMPORTANT:
- Change
INSTANCE_FOLDER_PATH
infbone/utils.py
to suit yourself. - Put
production.cfg
underINSTANCE_FOLDER_PATH
.
├── app.wsgi (mod_wsgi wsgi config)
├── CHANGES
├── fabfile.py (fabric file)
├── fbone (main app)
│ ├── api (api module)
│ ├── app.py (create flask app)
│ ├── config.py (config module)
│ ├── decorators.py
│ ├── extensions.py (init flask extensions)
│ ├── frontend (frontend module)
│ ├── __init__.py
│ ├── settings (settings module)
│ ├── static
│ │ ├── css
│ │ ├── favicon.png
│ │ ├── humans.txt
│ │ ├── img
│ │ ├── js
│ │ └── robots.txt
│ ├── templates
│ │ ├── errors
│ │ ├── frontend
│ │ ├── index.html
│ │ ├── layouts
│ │ ├── macros
│ │ ├── settings
│ │ └── user
│ ├── translations (i18n)
│ ├── user (user module)
│ │ ├── constants.py
│ │ ├── forms.py (wtforms)
│ │ ├── __init__.py
│ │ ├── models.py
│ │ ├── views.py
│ ├── utils.py
├── LICENSE
├── manage.py (manage via flask-script)
├── MANIFEST.in
├── README.markdown
├── screenshots
├── setup.py
└── tests (unit tests, run via `nosetest`)
Thanks to Python, Flask, its extensions, and other goodies.