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!

Todo

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

Modeling Your Application

SQLAlchemy is the default data-storage layer for TurboGears 2.1.5. Ming is supported as the alternative storage layer for MongoDB. The SQLAlchemy-migrate project is the officially supported mechanism for updating and migrating your database.

Todo

Document initial DB setup in websetup.py

Todo

Link DB setup (MySQL, PostgreSQL, etceteras) docs

Todo

document the transaction module, part of the repoze.tm package, introduction for implementers here… http://repoze.org/tmdemo.html

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.

Templates/Views

By default your TurboGears 2.1.5 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.

Todo

JQuery, Dojo, EXT usage doc-links

Todo

Link documentation for doing JSON RPC/Ajax here

Performance and optimization

Todo

Difficulty: Medium. optimization tips for SQLAlchemy usage

Todo

Difficulty: Easy. Validate that toctree maxdepth values are appropriate

Todo

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.5 works, changes since the 1.x release, and how to contribute to the project