Weber

What is Weber?

Weber is a set of template projects for starting production-ready webapps, enabling rapid development and deployment.

Weber provides:

  1. Backend code based on Flask
  2. Out-of-the-box deployment via Ansible, Vagrant
  3. Unit tests foundation for testing either the fully deployed app or a mock using Flask-Loopback
  4. Background jobs using Celery (Optional)
  5. User management using Flask-Security (Optional)
  6. Database connectivity and modeling using Flask-SQLAlchemy (Optional)
  7. Frontend foundation using Ember.js (Optional)

Getting Started

Choosing the right variation of Weber

The first step is to decide which variation of Weber should you use for starting your project. Currently, Weber provides 3 variations:

  1. weber-minimal - Contains a backend based on Flask as well as deployment tools for the platforms specified above. This template is the most simple one to work with and requires that you’ll be familiar with Flask and the deployment framework of your choice. This template is recommended for very basic web services or web applications. Web applications created from this template will use server-side template rendering using the Jinja2 framework.
  2. weber-backend - In addition to everything contained in weber-minimal, weber-backend also contains integration with SQLAlchemy using Flask-SQLAlchemy and the ability to queue background jobs using Celery. It also contains a tool for migrating production databases to newer schemas and optinal user management using Flask-Security. In order to use this template you should also be familiar with SQLAlchemy and the SQL database of your choice. This template is recommended for more complex web services or web applications that requires a use of a database.
  3. weber-frontend - This template is intended for fully interactive “single page” web applications. The use of Jinja2 to render web pages is discouraged with this template. Instead, the backend is expected to deliver the client side Ember.js application as well provide API for the application. Templates should be rendered by the client using HTMLBars, which is a superset of Handlebars. This template makes heavy use of client side frameworks such as Ember.js, ember-cli, ember-data, Sass and Bootstrap. You should be familiar with these frameworks if you intend to use weber-frontend.

Note that once you fork one of the templates, there’s no simple way to “upgrade” it to the next level of Weber. You should consider carefully which template is best suited to your needs.

Bootstrapping

After you decide which variation of Weber to use, the first step would be to fork it in Github. When forking, remember to rename weber to your project’s name.

Once forked, the first thing you should do is to run the test server to make sure that everything is working as expected. However, note that Weber use Python 2.7 by default. If you wish to use a different Python version, see Using an alternative Python version before proceeding.

Next, you should invoke manage.py testserver. Depending on your variant of Weber, this script my only run the test server, or a tmux instance running the multiple components needed for serving the application. Surf to http://localhost:8000 to see that everything works.

Now it’s time to actually write code. You might want to proceed to Project Layout.

Acknowledgements

Many special thanks and credit goes to Roey Darwish Dror for helping out with lots of features, bug fixes, and documentation.

Indices and tables