Strange behavior with two Trac instances under Apache + mod_wsgi
I am trying to set up two Trac instances to access them through the browser, each with a different URL:
http://trac.domain.com/trac1
http://trac.domain.com/trac2
The first time I access them, Apache's answer is fine, I get the first Trac with / trac 1 and then the second in / trac 2. But when I get / trac 1 again, it keeps giving me the contents of the second Trac (/ trac2). If I touch the .wsgi config file for the first one (say trac1.wsgi) then request / trac 1 with the browser again, I get the expected content again.
The opposite case works the same: access / trac2, then / trac1, then / trac 2 continues to give the contents of / trac 1 until I touch trac2.wsgi ...
So it seems like Python, mod_wsgi and / or Apache are cache results or something. I am not a sysadmin and cannot proceed with this problem.
The .wsgi and http.conf files for Apache:
trac1.wsgi :
import os
os.environ['TRAC_ENV'] = '/home/myuser/trac/trac1'
os.environ['PYTHON_EGG_CACHE'] = '/tmp/'
import trac.web.main
application = trac.web.main.dispatch_request
trac2.wsgi :
import os
os.environ['TRAC_ENV'] = '/home/myuser/trac/trac2'
os.environ['PYTHON_EGG_CACHE'] = '/tmp/'
import trac.web.main
application = trac.web.main.dispatch_request
http.conf :
<VirtualHost trac.domain.com:8080>
WSGIScriptAlias /trac1 /home/myuser/public_html/trac1/apache/trac1.wsgi
WSGIScriptAlias /trac2 /home/myuser/public_html/trac2/apache/trac2.wsgi
<Directory /home/myuser/public_html/trac1/apache>
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
<Location "/trac1">
AuthType Basic
AuthName "Trac1 Trac Auth"
AuthUserFile /home/myuser/public_html/trac1/apache/trac1.htpasswd
Require valid-user
</Location>
<Directory /home/myuser/public_html/trac2/apache>
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
<Location "/trac2">
AuthType Basic
AuthName "Trac2 Trac Auth"
AuthUserFile /home/myuser/public_html/trac2/apache/trac2.htpasswd
Require valid-user
</Location>
</VirtualHost>
If anyone suggests an alternative configuration or something else, that would be welcome too. thank!
Hector
source to share
Move your cache for cache to a separate directory
trac1.wsgi:
import os
os.environ['TRAC_ENV'] = '/home/myuser/trac/trac1'
os.environ['PYTHON_EGG_CACHE'] = '/tmp/trac1'
import trac.web.main
application = trac.web.main.dispatch_request
trac2.wsgi:
import os
os.environ['TRAC_ENV'] = '/home/myuser/trac/trac2'
os.environ['PYTHON_EGG_CACHE'] = '/tmp/trac2'
import trac.web.main
application = trac.web.main.dispatch_request
source to share