apache/mod_wsgi daemon mode

Scott SA pydev at rscorp.ab.ca
Sun Feb 3 17:23:03 EST 2008


HI,

I'm posting this here because it is, I believe, a python config issue (mine) that is not correct, but frustration and inexperience has left me without further [visible] options for rectification.

I am trying to configure mod_wsgi to run in daemon mode with Apache. I can easily get it to run 'normally' under Apache but I obtain permission errors _or_ process-failures in daemon mode. Specifically: 
    
     ... (13)Permission denied: mod_wsgi (pid=26962): Unable to connect 
     to WSGI daemon process '<process-name>' on 
    '/etc/httpd/logs/wsgi.26957.0.1.sock' after multiple attempts.


My httpd.conf contains an entry like this, and has had several variations:

    <VirtualHost host.domain.com:80>
       ServerName host.domain.com
    
       WSGIDaemonProcess <process-name> user=<user> group=<group> threads=10 \
                maximum-requests=500

       # the following line has been added/removed with no improved results
       WSGIProcessGroup <process-name>
    
       WSGIScriptAlias /something /path/to/<script>.wsgi
    
       <Directory /path/to/<script>.wsgi>
          # the following two lines have been added/removed 
          #with no improved results
          WSGIApplicationGroup <user>
          WSGIProcessGroup <process-name>
          
          Order deny,allow
          Allow from all
       </Directory>
    
        ...
    </VirtualHost>


My <script>.wsgi is as follows - but we never get this far!:

    import os, sys
    sys.stdout = sys.stderr
    
    # in this instance, I've been testing with a trac instance
    os.environ['TRAC_ENV'] = '/path/to/trac'

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



I have made changes in a number of combinations, trying to pinpoint where the problem is occurring. If I don't attempt to run this as a daemon, all is fine. I have noted where I have added/removed the ProcessGroup adn ApplicationGroup directives in an attempt to find the root of problem.

The host is Apache 2.2n under CentOS 5.1 i386 running Python 2.4

I have read, and re-read, mimicked settings from the following sites:
    
    http://code.google.com/p/modwsgi/wiki/IntegrationWithTrac
    http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines
    http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives
    
    as well as several excelent postings from Graham Dumpleton

So, if you listen close enough, you will hear the sound of my head banging against an unforgiving brick wall ;-)

Thanks in advance to any and all relevent advice or suggestions.

Scott



More information about the Python-list mailing list