set up trac with wsgi
Question: I have followed the following steps

  1. downlaod trac 1.0.9
  2. install using `python2.7 ./setup.py install` . this is a altinstall of python on centos 6 64 bit
  3. created repository on `trac-admin operationalintelligence initenv`
  4. trying to set up apache but not working

I have selinux enabled and have run `chcon -R -t httpd_sys_content_t
/usr/share/trac`

>
>     <  Location /trac/operationalintelligence  >
>  
>  
>  
>        SetHandler mod_python
>  
>        PythonHandler trac.web.modpython_frontend
>  
>        PythonOption TracEnv "/usr/share/trac/operationalintelligence"
>  
>        PythonOption TracUriRoot "/usr/share/trac/operationalintelligence"
>  
>        SetEnv PYTHON_EGG_CACHE /tmp
>  
>        PythonInterpreter trac
>     </Location>
>  

Apache fails when trying to restart.

with the following config i am recieving the error below

    
    
    Invalid command 'PythonInterpreter', perhaps misspelled or defined by a module not included in the server configuration
    
    
    #Alias /trac /usr/share/trac/operationalintelligence
    
    #<Directory /usr/share/trac/operationalintelligence>
    #   SetHandler mod_python
    #   PythonInterpreter main_interpreter
    #   PythonHandler trac.web.modpython_frontend
    #   PythonOption TracEnv /usr/share/trac/operationalintelligence
    #   PythonOption TracUriRoot /trac
    #</Directory>
    

I have now tried wsgi configuration which is progressing

    
    
     WSGIScriptAlias /trac /usr/share/trac/operationalintelligence/cgi-bin/trac.wsgi
    
    <Directory /usr/share/trac/operationalintelligence/cgi-bin>
        WSGIApplicationGroup %{GLOBAL}
        # For Apache 2.2
        <IfModule !mod_authz_core.c>
            Order deny,allow
            Allow from all
        </IfModule>
        # For Apache 2.4
        <IfModule mod_authz_core.c>
            Require all granted
        </IfModule>
    </Directory>
    

The error i receive in httpd error log is

    
    
    [Thu Feb 04 17:40:52 2016] [error] [client 47.73.16.6] mod_wsgi (pid=30558): Exception occurred processing WSGI script '/usr/share/trac/operationalintelligence/cgi-bin/trac.wsgi'.
    [Thu Feb 04 17:40:52 2016] [error] [client 47.73.16.6] Traceback (most recent call last):
    [Thu Feb 04 17:40:52 2016] [error] [client 47.73.16.6]   File "/usr/share/trac/operationalintelligence/cgi-bin/trac.wsgi", line 30, in application
    [Thu Feb 04 17:40:52 2016] [error] [client 47.73.16.6]     from trac.web.main import dispatch_request
    [Thu Feb 04 17:40:52 2016] [error] [client 47.73.16.6] ImportError: No module named trac.web.main
    [Thu Feb 04 17:40:58 2016] [error] [client 47.73.16.6] mod_wsgi (pid=30553): Exception occurred processing WSGI script '/usr/share/trac/operationalintelligence/cgi-bin/trac.wsgi'.
    [Thu Feb 04 17:40:58 2016] [error] [client 47.73.16.6] Traceback (most recent call last):
    [Thu Feb 04 17:40:58 2016] [error] [client 47.73.16.6]   File "/usr/share/trac/operationalintelligence/cgi-bin/trac.wsgi", line 30, in application
    [Thu Feb 04 17:40:58 2016] [error] [client 47.73.16.6]     from trac.web.main import dispatch_request
    [Thu Feb 04 17:40:58 2016] [error] [client 47.73.16.6] ImportError: No module named trac.web.main
    ^C
    


Answer: The problem with ModPython looks to be due to mod_python not being loaded.
Try:

    
    
    a2enmod mod_python
    

The problem with WSGI looks to be due to the Trac package not being found on
your Python path. It could be a permissions issue.

