[r7423]: docs / 1.1 / ProjectStructure.rst  Maximize  Restore  History

Download this file

108 lines (75 with data), 3.5 kB

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 setup.py.

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 :doc:`configuration reference </Configuration>` for more information.


<yourpackagename>/ controllers.py
Write your controllers (main program) here. If you use the quickstart template for :doc:`big applications <CreatingBigApplications>`, this is a sub-package directory named controllers and the root controller will be in <yourpackagename>/controllers/root.py.
<yourpackagename>/ model.py
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. :doc:`Test your web application <Testing>` 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.