Tips and Recipes

This page collects documentation which describes how to work with TurboGears to accomplish an effect. Normally you should have completed a few Advanced Tutorials so that you have a feel for the general workflow within TurboGears before you dive into these documents.

Core: Read These Pages!

These pages are the most useful pages for a new TurboGears developer to read after going through the tutorials. Reading the material here will help make you a more productive developer with TurboGears.

We cannot stress this enough: Read These Pages!


link repoze.who, repoze.what, and the other key middleware

Modeling Your Application

SQLAlchemy is the default data-storage layer for TurboGears 2.1. The SQLAlchemy-migrate project is the officially supported mechanism for updating and migrating your database.


Document initial DB setup in


Link DB setup (MySQL, PostgreSQL, etceteras) docs


document the transaction module, part of the package, introduction for implementers here…

Automatic Forms/Controllers

The TurboGears Admin system is built on top of the Sprox and tgext.crud system. You can use the same automatically generated forms and controllers to help you quickly prototype your applications. The Movie Tutorial introduces this usage of Sprox.


By default your TurboGears 2.1 project will be configured to use the Genshi templating language. TurboGears allows for the use of alternate templating languages.

Note: most new users do not need to choose an alternate templating language.

Javascript Libraries

Modern web-sites are dynamic, flexible, Javascript-code-heavy pieces of software. You will almost certainly want to use one of the major Javascript libraries to make the process of creating your sites less painful. The ToscaWidgets package provides plug-ins for each of the three major libraries, JQuery, Dojo and Ext, as well as the older Mochikit package which was the default in TurboGears 1.x.


JQuery, Dojo, EXT usage doc-links


Link documentation for doing JSON RPC/Ajax here

Performance and optimization


Difficulty: Medium. optimization tips for SQLAlchemy usage


Difficulty: Easy. Validate that toctree maxdepth values are appropriate


Difficulty: Easy. Explain usage of tgscheduler and how to use SQLAlchemy in a task

Next Steps

  • The Gears in Detail – learn how TurboGears 2.1 works, changes since the 1.x release, and how to contribute to the project