QuickStart Your Project

TurboGears has a command line tool named tg-admin, which provides a suite of tools for working with TurboGears projects. A few will be touched upon in this guide, but check the tg-admin reference for a full listing.

Create a New Project

The very first tool you’ll need is quickstart, which creates a new TurboGears project. Open a command line and run:

$ tg-admin quickstart

You’ll be prompted for the name of the project (this is the pretty name that human beings would appreciate), and the name of the package (this is the less-pretty name that Python will like).

For the identity prompt, for now you should answer ‘no’, since we’ll keep this guide fairly simple, but when you need users and passwords in a future project, you’ll want to look up the identity management tutorial.

Here’s what our choices for this tutorial look like:

Enter project name: TGExample
Enter package name [tutorial]: tgexample
Do you need Identity (usernames/passwords) in this project? [no] no
[... lots of output stripped here ...]

This creates a few files in a directory tree just below your current directory.

Let’s go in there and you can take a look around:

$ cd TGExample/

Lots of files and sub-directories have been created in there, but to get started, you will only need to know about a few of them, which we have described on the project structure page.

Run the Server

At this point your project should be operational. Make sure this is the case by starting the built-in web server:

$ python start-tgexample.py

Point your browser at http://localhost:8080/, and you’ll see a nice welcome page with the a message at the top stating:

Your application is now running

and the current date and time is displayed to confirm that you are indeed looking at the fresh output from your new TurboGears application.

Tip

If you’re on a Mac and have Bonjour bookmarks turned on in Safari, you’ll see your new server show up there!