TurboGears: Web development done right

gearRuby on Rails is still the Hot Thing of the Moment for at least 68.4% of web developers, according to my highly scientific poll which involved asking no one at all. But while Dave Heinemeier Hansson was busy basking in his (entirely deserved) glory, other easy web development frameworks have come sneaking up from behind. “Yeah, those metoo projects,” you might say, “they try to mimic RoR in PHP and COBOL! Fools! They don’t realize that the Ruby bit is essential!” And you’d be making a good point. That’s why I chose a project with a different philosophy into whose direction you may kindly orient your nose now.

TurboGears is as fresh as a breath mint after a week-long diet of anchovies in garlic oil!

At first it sounded like another one of those metoos, trying to lull me in with enthusiastic, bubbly tutorials and videos of men in dotted blue shirts developing a wiki in 20 minutes. I was sceptical, so I tried to do one of the tutorials and see how fast the shine would wear off once the nice man is gone and I’m writing my own horrid code. 90 minutes later, while I realize I’ve only scratched the surface, I’m still having a warm fuzzy feeling in my tummy. TurboGears feels like web development done right.

Right now I’m reading more about the philosophy of the project, and guess what, it seems sound. TurboGears is not a Rails clone. Instead, TurboGears takes tried and true Python components that have existed long before Rails and adds its own magic, all the while giving its improvements back to the projects it unites. This seems to be very much in the spirit of free software. Most of the components in TurboGears can even be switched out for others if you like those better. Freedom here, too.

Before I close this off, let me talk about one of the most interesting things I’ve found in TG: the Toolbox. This is a small web application, probably also built in TurboGears, that you can start with the *tg-admin* utility. Go ahead, type *tg-admin toolbox* in your TG project’s directory and see what happens. This thing is mad! It consists of the following components:

* *System Info*, a screen that shows you a listing of installed components and their versions (boring)
* *Web Console*, a web-based Python console that allows you to interact directly with your application (less boring)

* *CatWalk*, a tool that goes **through** your models **into** your database and lets you manipulate records on the fly. It’s like performing drive-by open heart surgery! (interesting)

* *Widget Browser*, a page that lists all sorts of TG widgets you can use in your web applications. Widgets are things that somehow end up on your web pages, mostly user interface elements. You can generate forms straight out of Python, or even do something clearly nuts like display a full-fledged calendar input field made out of sticky AJAX substance. A calendar input field! Using *three lines* of Python code! (totally, totally nuts)

* *Model Designer*, a semi-graphical tool to design your data models with. We’re still running in the browser, remember? You can basically model your entire database with this thing, and in the end it generates SQLObject code for you that will set up your DB. All nonchalantly in the background, it draws a friggin diagram of your tables and how they relate to each other. A diagram! You can even drag elements of the diagram around to get a better view! (intriguing and compelling!)

* *admi18n*, an admin console that helps you internationalize your project. The whole thing uses gettext in the back, so all your gettext skills come back to haunt you good use. adminternationalization, as I will spell it from now on, will cheerfully collect all the strings from your application, package them so you can give the misbehaving little things to a translator, and compile the catalogs back into a form the application can use. Killer! (heart attack imminent)

The toolbox alone was enough to keep a grin on my face for an hour as I clicked and clocked cheerfully, not even doing anything productive.

The advantages of learning TurboGears, as I see them:

* The Toolbox. Gods, why doesn’t everyone have this?

* You learn how to use SQLObject, CherryPy, Kid, MochiKit and the other components that make up TurboGears. This makes your time investment pay off more — even if you decide to abandon TurboGears one day, the knowledge you’ve gained about the other things can still help you in future projects. Not all of these technologies are exclusive to the Web, either. SQLObject can help you in anything, from game development to normal desktop applications with GUIs.

* The ease of creating internationalized content with TurboGears is unparalleled by any other web framework I know of. It even goes and gathers your strings for you, and it all uses the standard gettext! This is years ahead of Ruby on Rails. RoR is currently a pain to internationalize, and since I live in a country with four official languages, that has always felt like a bummer.

* TurboGears grows with your needs and tries to minimize the growing pains. I know it’s silly of me to make such claims after barely finishing a single tutorial, but on paper it looks very plausible indeed. Talk to some of the people who have developed these websites if you need proof or want to chat to someone who made a big site with TG.

I can see myself doing my next web project using TurboGears. As in, right *now*.

-bleep-

3 thoughts on “TurboGears: Web development done right”

  1. Thanks, and hopefully not! 🙂 I like RoR as well, but for other reasons.

    I’m putting together a heavily internationalized site at the moment, but with a rather simple database design. It seems TurboGears is better suited for this than RoR, where UTF-8 support and general internationalization are a bit of a bother at the moment. I don’t have much time at all these days so my progress will be slow, but I hope I can one day start a rewrite of that same site in RoR in order to write a little article comparing the experiences.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s