| 1 | | """ |
|---|
| 2 | | Place to hold TurboGears built-in templates |
|---|
| 3 | | |
|---|
| 4 | | With 'paster quickstart' or 'paster create' command you can create a new |
|---|
| 5 | | TurboGears project which you can use as a basis for your own project. |
|---|
| 6 | | Let's take the command 'paster quickstart helloworld' for example. |
|---|
| 7 | | The generated directory structure is as follows:: |
|---|
| 8 | | |
|---|
| 9 | | - helloworld/ |
|---|
| 10 | | - helloworld/ |
|---|
| 11 | | - development.ini |
|---|
| 12 | | - setup.cfg |
|---|
| 13 | | - setup.py |
|---|
| 14 | | - test.ini |
|---|
| 15 | | |
|---|
| 16 | | |
|---|
| 17 | | The setup.py file is used to create a re-distributable Python |
|---|
| 18 | | package of your project called an egg. Eggs can be thought of as |
|---|
| 19 | | similar to .jar files in Java. |
|---|
| 20 | | The setup.cfg file contains extra information about your project. |
|---|
| 21 | | |
|---|
| 22 | | The sub 'helloworld' directory within the root 'helloworld' directory |
|---|
| 23 | | is where all your application specific code and files are placed. |
|---|
| 24 | | The sub directory looks like this:: |
|---|
| 25 | | |
|---|
| 26 | | - helloworld/ |
|---|
| 27 | | - config/ |
|---|
| 28 | | - controllers/ |
|---|
| 29 | | - lib/ |
|---|
| 30 | | - model/ |
|---|
| 31 | | - public/ |
|---|
| 32 | | - templates/ |
|---|
| 33 | | - tests/ |
|---|
| 34 | | - __init__.py |
|---|
| 35 | | - websetup.py |
|---|
| 36 | | |
|---|
| 37 | | The config directory contains the configuration options for your web application. |
|---|
| 38 | | |
|---|
| 39 | | The controllers directory is where your application controllers are written. |
|---|
| 40 | | Controllers are the core of your application where the decision is made on what |
|---|
| 41 | | data to load, and how to view it. |
|---|
| 42 | | |
|---|
| 43 | | The lib directory is where you can put code that is used between different |
|---|
| 44 | | controllers, third party code, or any other code that doesn't fit in well elsewhere. |
|---|
| 45 | | |
|---|
| 46 | | The models directory is for your model objects, if you're using an ORM this is |
|---|
| 47 | | where the classes for them should go. |
|---|
| 48 | | Objects defined in models/__init__.py will be loaded and present as model. |
|---|
| 49 | | YourObject inside your controllers. The database configuration string can be set |
|---|
| 50 | | in your development.ini file. |
|---|
| 51 | | |
|---|
| 52 | | The public directory is where you put all your HTML, images, Javascript, CSS and |
|---|
| 53 | | other static files. It is similar to the htdocs directory in Apache. |
|---|
| 54 | | |
|---|
| 55 | | The templates directory is where templates are stored. Templates contain a mixture of |
|---|
| 56 | | plain text and Python code and are used for creating HTML and other documents in a way |
|---|
| 57 | | that is easy for designers to tweak without them needing to see all the code that |
|---|
| 58 | | goes on behind the scenes. |
|---|
| 59 | | TurboGears 2 uses Genshi templates by default but also supports Mako, Cheetah, Kid and |
|---|
| 60 | | others through a system called Buffet. See how to change template languages. |
|---|
| 61 | | |
|---|
| 62 | | The tests directory is where you can put controller and other tests. The controller |
|---|
| 63 | | testing functionality uses Nose and paste.fixture. |
|---|
| 64 | | |
|---|
| 65 | | The __init__.py file is present so that the helloworld directory can be used as a Python |
|---|
| 66 | | module within the egg. |
|---|
| 67 | | |
|---|
| 68 | | The websetup.py should contain any code that should be executed when an end user of your |
|---|
| 69 | | application runs the paster setup-app command described in Application Setup. |
|---|
| 70 | | If you're looking for where to put that should be run before your application is, |
|---|
| 71 | | this is the place. |
|---|
| 72 | | |
|---|
| 73 | | """ |
|---|