O'Reilly logo

Next-Generation Web Frameworks in Python by Liza Daly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

TurboGears

Philosophy: a Megaframework at 1.0

When you use Django, you are using the Django templating system with the Django database mapper with the Django URL/controller framework. TurboGears (http://www.turbogears.com) takes the opposite approach, unifying mature projects into a "mega-framework." Central to the mega-framework approach is the idea that, while core packages should be supported out-of-the-box, it should be easy to plug in or replace most of the layers.

Powered by CherryPy

The single un-replaceable subproject in TurboGears is CherryPy (http://cherrypy.org), the multithreaded web server written entirely in Python. It is less analogous to a pure HTTP server such as Apache and is more of a runtime container, as Tomcat is for Java. CherryPy provides mechanisms for responding to requests, attaching methods to serve those requests, and establishing session, request, and response objects. TurboGears is essentially an extension of CherryPy.

Unlike the Django development server or WEBrick in Rails, CherryPy is a production-level server. CherryPy can be mounted behind Apache or IIS for deployment purposes but CherryPy will handle the actual work of servicing user requests in a TurboGears project. It supports all the standard HTTP server functions, including serving static assets (such as images), file upload, exception handling, and logging.

Having a production-quality server embedded in the framework is a huge win at launch time, as any developer who has struggled to migrate ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required