Pillars of Python: Six Python Web frameworks compared
CubicWeb, Django, Pyramid, Web.py, Web2py, and Zope 2 give Python-savvy Web application developers powerful and diverse options
Python Web frameworks: Min or max?
If you prefer a framework that puts the minimum between you and the Web, then Web.py will be your best choice. On the other hand, if you like wizards guiding you along the way, then you may prefer Web2py. CubicWeb is an excellent choice if your data comes from disparate sources. If your website's structure is data driven, then have a look at Pyramid or Zope 2. In addition, Zope 2 and Django are solid all-around choices, both having stood the test of time.
But these are only general suggestions. It's not the case that any particular Python Web framework is at a significant disadvantage to the others. As usual, the choice is highly subjective. You will find zealots for each product, and every zealot is able to present rational reasons why their chosen framework is superior.
Naturally, the current discussion paints only an overview. For the finer details, follow the links in the table below and plunge into the individual reviews.
Python Web frameworks compared
Python versions | Licensing | Documentation | Web servers | |
---|---|---|---|---|
CubicWeb 3.12.5 | Any 2.x Python back to 2.5 | LGPL | Tutorials, online user guide, and administration guide, all available from the main Web page | Twisted Web server, usually run with Apache. WSGI support is in the works. |
Django 1.3 | Any 2.x Python version | BSD | Tutorial, reference guide, and how-to guides, arranged like an online book | Any Web server that supports WSGI or FastCGI |
Pyramid 1.0 | Python 2.4 through 2.7 | BSD-like | User guide, tutorials, sample applications, and API reference | Any Web server that supports WSGI. Also includes its own Web server suitable for large-scale applications. |
Web.py 0.35 | Any 2.x Python back to 2.3 | No restrictions, but includes the CherryPy Web server governed by the CherryPy license | Cookbook, API reference, and categorized code examples | Any Web server supporting CGI, FastCGI, SCGI, or WSGI |
Web2py 1.95 | Python 2.5 through 2.7 | LGPL | Online book, example website, lots of online "quick examples" | Any Web server that supports Python |
Zope 2.13 | Depends on Zope 2 version, varying from Python 2.4 for Zope 2.11.x to Python 2.7 for Zope 2.13.x | Zope Public License | Online book includes API reference, management interface guide, templates reference, and more | Any Web server that supports Python. Also includes its own Web server suitable for production use. |
Python Web frameworks compared, continued
Database support | Caching | Debugging | Logging | JavaScript support | |
---|---|---|---|---|---|
CubicWeb 3.12.5 | MySQL, PostgreSQL, SQLite, Microsoft SQL Server | Planned | Debug mode will display log messages on a console, show trace information, show generated SQL queries, and more | Yes | Yes, based on JQuery |
Django 1.3 | MySQL, PostgreSQL, SQLite, Oracle; third-party support for other databases | Yes, both at the model and view levels | Yes; both in its development Web server and a special debug execution mode | Uses standard Python logging; latest version added configuration hooks | None specific, though third-party libraries for integrating JavaScript libraries are available |
Pyramid 1.0 | Any Python ORM tool such as SQLAlchemy, MongoDB, and Cassandra | Yes, via the Python Beaker package; provides page-level database query and other caching | Yes; interactive debugger that runs in the browser provides detailed stack trace | Yes, via standard Python logging package | No, though Pyramid does provide convenience functions for JSON and Ajax |
Web.py 0.35 | MySQL, PostgreSQL, SQLite, Microsoft SQL Server, Oracle, Firebird | Some support for caching templates | Yes; debug mode will automatically load code changes and provide detailed error pages | No, but you can incorporate the Python logging system | Yes, via jsdef (used in the template language) |
Web2py 1.95 | MySQL, PostgreSQL, SQLite, Microsoft SQL Server, Oracle, IBM DB2, Informix, Ingres, Firebird, Google App Engine | Yes; caching is integrated with database queries | No, but logging system tickets any uncaught exceptions | Yes, using the standard Python logging module; every app writes to its own log | Yes, custom JavaScript atop JQuery is used in various places |
Zope 2.13 | Zope Object Database (ZODB) and third-party ZODB emulators such as RelStorage | Yes; includes several built-in caching helpers | Yes; debug mode lets you run Zope while watching debugging and logging output | Yes; uses standard Python logging capability | None specific |
This article, "Pillars of Python: Six Python Web frameworks compared," was originally published at InfoWorld.com. Follow the latest developments in application development and Python at InfoWorld.com. For the latest developments in business technology news, follow InfoWorld.com on Twitter.
Copyright © 2011 IDG Communications, Inc.