The default TG setup is a little more Pythonic than some web developers are used to, and doesn't lend itself well to a collaborative development environment that uses Subversion to enforce different permissions based on a directory structure.
Most of this can be quickly alleviated with some design ideas.
Please note that these ideas are more geared towards splitting files up into what some people feel are more managable directories.
To address the needs of a truly large application, consider breaking the application into several applications and using them in conjunction with one another. More information is in this posting on the newsgroup
There are 2 ways to split controllers up in TurboGears
Introduced in TG 0.9a2 , the tgbig template adds a controllers package to the template.
The single file controllers.py is then replaced with a controllers directory/package that consolidates the root level controllers intto controllers/root.py:
tg-admin quickstart -t tgbig
creates
Some people prefer an alternate approach. Several on the Newsgroup seemed to have implemented variations on the tgbig behaviour.
In FastTrack, a 'subcontrollers' directory was created controllers.py reads as follows (abridged):
subcontrollers/dashboard.py reads:
Note that model needs to be specifically addressed by namespace when being imported.
This was posted to the Newsgroup by justi...@ntlworld.com
I renamed controllers.py to controller.py - the idea being that this is just the _root_ controller. Next, I created a directory: controllers/ which contains things like: controllers/ blog_controller.py forum_controller.py login_controller.py json_api_controller.py ... For controller.py then:
If this method is used, the start-APPNAME.py script must be altered to reference controller.py.
The main difference between the approaches is that tgbig is more 'pythonic' -- controllers is a package, with root.py being the main controller. The alternate methods are more simlar to other web frameworks: they keep controller(s).py as the main controller and mount a tree of controllers under it, much like a tree of directories on a web server.
The way to get templates into subdirectories seems to change based on TG revisions - I tried some tricks from the newsgroup (some people said import each template directly, others created controllers to juggle namspace issues) but none worked on 0.9a4.
What does work on 0.9a4 is this:
Aside from cleaning up the files and letting a team work on components separately, you get the benefit of using SVN to indpendently manage permissions.
Example: