ramkrishanbhatt / modwsgi

Automatically exported from code.google.com/p/modwsgi
0 stars 0 forks source link

Trac home is not get from *.wsgi #75

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
On reload url a get random trac db: main or noc:
1. open url /projects/main - I get main trac
2. reload url /projects/main - I get noc trac
etc.

I have a directory /var/trac, where main.wsgi and noc.wsgi live:

main.wsgi:
import os

os.environ['TRAC_ENV'] = '/var/trac/main'
os.environ['PYTHON_EGG_CACHE'] = '/tmp/.egg'

import trac.web.main
application = trac.web.main.dispatch_request

noc.wsgi:
import os

os.environ['TRAC_ENV'] = '/var/trac/noc'
os.environ['PYTHON_EGG_CACHE'] = '/tmp/.eggnoc'

import trac.web.main
application = trac.web.main.dispatch_request

httpd.conf:
  WSGIScriptAlias /projects/main /var/trac/main.wsgi
  WSGIScriptAlias /projects/noc /var/trac/noc.wsgi
  <Directory /var/trac/>
    WSGIApplicationGroup %{GLOBAL}
    Order deny,allow
    Allow from all
  </Directory>

Original issue reported on code.google.com by kingo...@gmail.com on 17 Apr 2008 at 9:02

GoogleCodeExporter commented 8 years ago
You cannot run two Trac instances in the same Python interpreter when using 
os.environ type configuration. You must use WSGI environment style 
configuration. One way is to use WSGI script file of:

  import trac.web.main
  application = trac.web.main.dispatch_request

and Apache configuration of:

  WSGIScriptAlias /projects/main /var/trac/apache/trac.wsgi

  <Location /projects/main>
  SetEnv trac.env_path /var/trac/main
  </Location>

  WSGIScriptAlias /projects/noc /var/trac/apache/trac.wsgi

  <Location /projects/main>
  SetEnv trac.env_path /var/trac/noc
  </Location>

  <Directory /var/trac/apache>
    WSGIApplicationGroup %{GLOBAL}
    Order deny,allow
    Allow from all
  </Directory>

If you insist on using os.environ type configuration, create two distinct 
daemon process groups and delegate each separate application to a distinct 
daemon process.

Read through the Trac integration guide for further examples:

  http://code.google.com/p/modwsgi/wiki/IntegrationWithTrac

Original comment by Graham.Dumpleton@gmail.com on 17 Apr 2008 at 9:12

GoogleCodeExporter commented 8 years ago
Thanks a lot! It is works now.

Original comment by kingo...@gmail.com on 17 Apr 2008 at 10:32

GoogleCodeExporter commented 8 years ago
Correct recipe covered by documentation.

Original comment by Graham.Dumpleton@gmail.com on 17 Apr 2008 at 12:10