4 Python Web Frameworks Compared

On February 26th, Six Feet Up participated in the IndyPy Python Web Shootout 2013, where 4 companies showed off 4 Python frameworks through the demo of a ToDo app developed in Bottle, Django, Flask and Pyramid.

Here’s a quick review of the various tools:

Pyramid – Flexible

Six Feet Up Dir. of Engineering Clayton Parker unveiled Pyramid. A demo of this version is available; the code powering it and step-by-step build instructions are on GitHub.

Pyramid was born out of a merge between Pylons 1.0 and repoze.bfg. Pyramid comes with “batteries included” but doesn’t make any assumptions about the components of your site. The Pyramid community is growing fast. Documentation is outstanding and allows developers to make progress without having to rely on the community support. Pyramid strives to be minimalistic, fast and reliable. It was one of the first web frameworks to be compatible with Python 3.

Pyramid is great for:

  • Getting started quickly
  • Developers working on API projects
  • Prototyping a concept
  • Developing large web applications, such as a CMS or a KMS

Bottle – Simple

Nathan Davis from Angie’s List started off by presenting his ToDo app built in Bottle, as it is the framework used in his company for API projects. The source for this example can be found on GitHub.

Bottle is a simple micro framework that provides minimal tools out of the box (routing, templating and a small abstraction over WSGI). Bottle can run on Python 3.

Bottle is great for:

  • Developers looking for flexibility
  • Creating a web API
  • People who want to build something really simple

Django – Powerful

Jason Sole and Jason McLaughlin from DirectEmployers showed off Django, which they use to power their job portal. The source for this example is on GitHub.

Django is by far the largest Python-based web framework. It is supported by a large and active community. It comes with a powerful admin interface as well as many other features out of the box. Django offers model-based forms, has its own templating language, and has excellent documentation available.

Django is great for:

  • Developers who like to share ideas with each other via online forums
  • Developers who want to build something quickly with powerful built-in tools

Useful Django apps:

  • South (for schema and data migrations)
  • Django Celery
  • Django Rest Framework or TastyPie
  • Django Extensions

Flask – Nimble

Pradeep Gowda, with ENthEnergy showed off Flask. The source for this example is on GitHub.

Flask is a micro framework that was originally created as an April Fool’s joke that proved a single file framework could exist. It strives to be simple and small; the entire framework consists of a handful of modules. There is no skeleton to start from; instead, you start with a blank page. While flask doesn’t provide a lot out of the box, there are Flask extensions available to add in ORM, form validation, upload handling, etc.

Flask is great for:

  • Learning programming
  • Developers who care about best practices and “tasteful” code
  • Developers who want to prototype something quickly
  • Developers who need a standalone app

Popular combinations of framework templating and ORM include the following:

  • Flask + Jinja2 + SQLAlchemy
  • Flask + Mako + SLQLAlchemy
  • Flask + Jinja2 + Peewee
  • Flask + CouchDB