Fbone (Flask bone) is a Flask (Python microframework) template/bootstrap/boilerplate application.
You can use it for
- learning Flask.
- quicker developing your new project.
- Well designed for large project.
- Support HTML5 with HTML5 Boilerplate.
- Integrate with jQuery and bootstrap.
- 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.
- Implement admin interface.
- Implement Logger.
- Handle i18n with Flask-Babel.
- Handle web forms with WTForms.
- Handle orm with SQLAlchemy.
- Handle deployment with mod_wsgi and fabric.
Pre-required:
- Ubuntu (or other linux distro)
- git
- pip
- fabric
- sqlite
- virtualenv
- apache + mod_wsgi
Assume you are in Ubuntu and the project name is "myapp".
sudo git clone https://github.com/imwilsonxu/fbone.git /srv/www/myapp
cd /srv/www/myapp
fab init:myapp
Restart apache and open http://127.0.0.1
, done!
Debug in local machine.
fab run
Open http://127.0.0.1:5000
, done!
Init/reset database (with sqlite, check out fbone/config.py
).
python manage.py initdb
sudo chmod o+w /tmp/<project>.sqlite
Debug with local server.
fab run
Compile babel.
fab babel
Use tree
to display project structure:
sudo apt-get install -y tree
cd fbone
tree
Explain:
├── app.vhost (mod_wsgi vhost)
├── app.wsgi (mod_wsgi wsgi config)
├── CHANGES
├── fabfile.py (fabric file)
├── fbone (main app)
│ ├── api (api module)
│ ├── app.py (create flask app)
│ ├── configs (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
│ │ │ ├── main.js
│ │ │ ├── plugins.js
│ │ │ └── vendor
│ │ └── 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 Flask, its extensions, and other goodies.