Trac - Multiple Projects

In my previous entry I quickly went through the process of setting up Trac. This set up basically worked with a single project.

You can of course support multiple projects via a single trac installation and that's what I'm going to show below.

The first thing I did was get rid of the following Alias, and replace it with ScriptAlias

#Alias /trac "d:/appservers/Python23/share/trac/htdocs"
ScriptAlias /trac "D:/appservers/Apache Group/Apache2/cgi-bin/trac.cgi"

I then commented out the following block and replaced it

#<Location /cgi-bin/trac.cgi>
#SetEnv TRAC_ENV "d:/svn/la.db"
#SetEnv PYTHONPATH "d:/Subversion/bin"
# if you are running Apache as a user other than System, the TMP variable
# needs to be set to a place where that user can write scratch files. Make
# sure that this directory is created and writable by that user.
#SetEnv TMP "c:/svn/trac.db/tmp"
#</Location>

<Location "/trac">
SetEnv TRAC_ENV_PARENT_DIR "d:/svn/"
SetEnv PYTHONPATH "d:/Subversion/bin"
</Location>

I then updated the authentication block by doing ... and this allows us to share the same password file across all our projects.

#<Location /cgi-bin/trac.cgi/login>
# AuthType Basic
# AuthName "LA"
# AuthUserFile passwd
# C:/svn/.htaccess
# AuthGroupFile svngroup
# Require valid-user
#</Location>

<LocationMatch "/trac/[^/]+/login">
AuthType Basic
AuthName "Trac"
AuthUserFile passwd
AuthGroupFile svngroup
Require valid-user
</LocationMatch>

Restart Apache and you're off...

http://mysite/trac/

Doing this will get you a list of projects you can choose from, or you can just do

http://mysite/trac/<projectname>

I should point out that there are other ways of running Trac, and different ways of supporting multiple projects. Also as I'm still learning all this stuff myself, I may not be getting everything "right", so feel free to shout in if you have suggestions.

I think I'll follow this up by talking about users and permissions ... though I believe I need to write the next entry for my AdminAPI series.

Related Blog Entries

Comments

Wayne Graham's Gravatar Noticed you were using the CGI method. I used this for a while and ended up switching to the mod_python mode (it sped up the response time considerably). Basically, the only thing you have to do on Windows is grab the mod_python.so and make sure you add it to the httpd.conf file (LoadModule python_module modules/mod_python.so) and then add

<Location /trac>
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir c:/svn/trac.db/tmp
PythonOption TracUriRoot /trac
</Location>

For more complete instructions, check out http://trac.edgewall.org/wiki/TracModPython.
# Posted By Wayne Graham | 25/08/06 15:10

Scotch on the Rocks 2008