Table Of Contents

The Project Structure

When you create a new TurboGears project, you will get a directory structure which at first glance seems to contains lots of files. It might seem difficult to understand their purpose but in practice, you need to know only about a small number of files. Those files can be categorized belonging to one of the four purposes listed below. Note that with TurboGears you’ll spend most of time on the files printed in bold.


Write about your project in here. By default this file gives instructions how to start the application.
Packaging, distribution and installation related settings.
To start your web application run this script with Python.
Application related information, like version number, authors, copyright etc. is provided here.
Auto-generated packaging meta-data from

You can publish your project to the Python Cheeseshop in minutes by changing only a few lines in the above files.


The deployment-specific configuration settings in development mode go in here.
A template for deployment-specific configuration settings in production mode.
<your project name>/config/*.cfg
These files contains the deployment-independent configuration settings of your application

You do most of configurations for your project in those files. See the configuration reference for more information.


Write your controllers (main program) here. If you use the quickstart template for big applications, this is a sub-package directory named controllers and the root controller will be in <yourpackagename>/controllers/
This file defines your application’s data model. If you chose to add identity support when creating your applications, the data model to support this has already been added to this file.
<yourpackagename>/ templates/
This is a package directory containing the templates (i.e. the view) () of your application.
Contains rules for turning your data model objects into JSON notation (optional).
This module contains functions that are intended to be run from the command line. By default it has the start-up code for your application and bootstrap command to create your database tables.
This directory contains all the static files, which are served by your application, like CSS files, images and JavaScript code.


Place your unit test code in this directory. Test your web application model, view, and controllers by writing a :doc:`/test`*.py file for each and run them trough nosetest.
This configuration file contains settings which are only active when running your application’s test suite. You may want to configure a different database and logging setup here.