Enter TurboGears
The meaning of "full-stack" is somewhat in the eye of the beholder, of course. But by most standards, TG does a good job of providing for all tiers of a typical Web application. Its major components are:
- SQLObject
- an Object-Relational Mapping (ORM) library
- CherryPy
- a lower-level Web application framework with a built-in HTTP server
- Kid
- a templating system that embeds Python code in well-formed XML documents
- MochiKit
- a rich but lightweight JavaScript library that supports asynchronous HTTP requests
Additional components provide support for unit testing, XML document navigation, form validation, and conversion between Python data structures and JavaScript Object Notation (JSON). Third-party extensions have started appearing, too, like the CatWalk model browser.
At first glance, TG looks a lot like Ruby on Rails. Certainly, the projects are similar in their goals and high-level architectures. And it is fair to say that TG is largely inspired by Ruby on Rails--but there are differences. For example, TG comes with built-in support for JavaScript Object Notation (JSON); combined with asynchronous HTTP requests, this facilitates AJAX development--or perhaps we should say "AJAJ"--by substituting a simpler data format for XML.
The templating systems are also significantly different: Kid templates consist of well-formed XML (often XHTML in practice) with Python embedded in attributes and element content, while Rails uses Embedded Ruby (ERuby), which uses non-XML tags to embed Ruby in (X)HTML or other text files.
One of the most important differences, however, is in the ORM layer: the ActiveRecord package used in Rails provides an object layer over an existing database, whereas Python's SQLObject also allows the database to be generated based on Python objects.
This is not to suggest that TG is superior in every respect. Rails has a "scaffolding" feature, which automatically generates CRUD (Create, Retrieve, Update, Delete) operations. There is also an ActionMailer package which provides e-mail services for applications. In other words, while TurboGears and Rails have many similarities, they are far from identical.
Beyond the differences in features, there remains the highly subjective matter of language choice. Even if TG were simply a clone of Rails, surely it is a wonderful thing that developers can implement architectures in the language of their choice. Isn't that what open source is all about? And the community appears to have ample energy for creating and maintaining Web frameworks.
To my mind, what really stands out about TG is the clear vision and the sense of competence that its developers are communicating. There are many technically sound and interesting Web tools available, but they often suffer from poor documentation and worse marketing. While its feature set is highly attractive in itself, it is the project's superior presentation that makes it likely to attract a broad following.
Additional Resources
- TurboGears home page
- TurboGears defined
- TurboGears: Python on Rails? (O'Reilly)
- Python Web Framework Niches (Groovie.org)
- Blue Sky on Mars (Kevin Dangoor)
- Rails everywhere (Slashdot)
- CatWalk home page
- Turbo Gears: Python in the battle (Ajaxian.com)
- TurboGears: is it really worth looking at? (O'Reilly)
Index entries for this article | |
---|---|
GuestArticles | Gushee, Matt |
Posted Oct 27, 2005 19:18 UTC (Thu)
by rjw (guest, #10415)
[Link] (1 responses)
It seems to me that TurboGears is being pimped so much mainly because it extesively packages up other libraries. I don't find this "Reuse is better than design" mantra particularly convincing.
Posted Oct 31, 2005 13:10 UTC (Mon)
by mgushee (guest, #33056)
[Link]
I'll take that as a compliment. Other than that, I'm not quite sure how to respond.
I have to confess to being excited about TurboGears ... as a long-time Python user, I liked the idea of Ruby on Rails but wasn't completely comfortable with it: didn't really have a good handle on the language, and the toolkit felt like there was too much magic going on behind the scenes.
Nonetheless, I didn't set out to evangelize TurboGears. I felt that it was newsworthy for the reason I mentioned in my conclusion. Is it *good* software (however we might define that term)? Hard to say: it doesn't have much of a track record yet. But I certainly searched for "the other side of the story," and there wasn't much ... the links I included with the article represent just about everything I found.
As for "reuse is better than design" ... you may have a valid point there, but I don't believe the two are mutually exclusive. In fact, I see TG as an effort to *integrate existing components into a large-scale design.*
But I'd be interested to hear more from you on that topic.
Certainly the tone of the article matches the authors surname.... Enter TurboGears
> Certainly the tone of the article matches the authors surname.... Enter TurboGears