TurboGears Configuration

TurboGears is designed to get running with a minimum of trouble and very little external configuration. For some applications, the only thing that will need to change from the basic "quickstart" configuration is the location of the database.

A quickstarted application comes with two config files: "dev.cfg" and "prod.cfg". The dev.cfg file is the one used while you're developing your application. prod.cfg contains appropriate settings for a "real" deployment, and can be passed in to your project's start script as a parameter.

CherryPy Configuration

TurboGears uses CherryPy's configuration system. The CherryPy site includes an overview of the configuration system and also includes a reference of some configuration options.

This document does not reproduce the basic CherryPy configuration options. It is a reference of TurboGears options.

TurboGears Configuration Reference

All TurboGears-specific configuration options go in the [global] configuration section.

autoreload.package
The autoreload functionality that comes with CherryPy reloads if any of the modules that have been imported change. This requires checking quite a few files and also is not compatible with zipped Egg files. TurboGears adds this config parameter to specify one package to watch for changes. For most applications this is adequate.
kid.outputformat
Sets the default output format used when rendering Kid templates. By default, TurboGears will tell Kid to produce HTML files, which is optimum for most web applications. If your application needs to output XHTML or XML, you can set that here. There is more information about the available output methods.
server.webpath
Specifies the root of the site for use when generating URLs. Use this if your whole TurboGears instance is not at the root of your webserver.
sqlobject.dburi
The SQLObject URI that identifies the database to use for this application. The general form of the URI is databasetype://username:password@hostname:port/databasename. Note that for sqlite, the format is more like that of a file:// URL: sqlite:///absolute_path_to_file. Also note that on Windows systems, you use a | character instead of a : to refer to a drive letter. For example: sqlite:///d|databases/foo.db points to D:\databases\foo.db.
tg.sitetemplate
TurboGears applications that are intended to be reused should make sure that every page template ultimately extends sitetemplate. This config variable lets you set which template is used as the sitetemplate. The value should be of the form "packagename.templates.templatename", including the quotes.