Mod_wsgi daemon mode not working in Apache

apache-2.2djangomod-wsgi

I have problems getting mod_wsgi to run in daemon mode on my Debian / Apache 2.2.16 / Python 2.6.6 / mod_wsgi 3.3 / Django 1.3 setup. Everything works OK in embedded mode, but when I try to switch to daemon mode like described in so many HOWTO's, it is simply not activated (environ['mod_wsgi.process_group'] always returns the empty string, but no errors are output).

Furthermore, setting the python path with neither the WSGIPythonPath directive nor the python-path option for WSGIDaemonProcess seems to work – outputting sys.path in the wsgi script always returns the original system python path.

I read up on configuring and debugging mod_wsgi, but I just seem stuck here so any help would be appreciated!

In my virtual host config file I have

<VirtualHost *:80>

  ServerName mysite.com

  WSGIDaemonProcess mysite.com processes=2 threads=15
  WSGIProcessGroup mysite.com

  WSGIScriptAlias / /path/to/mysite/wsgi/django.wsgi

  <Directory /path/to/mysite/wsgi/>
    Order deny,allow
    Allow from all
  </Directory>

</VirtualHost>

set up. To test activation of daemon mode, I use this wsgi script:

import sys
import os

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')

def application(environ, start_response):
    print >> sys.stderr, 'mod_wsgi.process_group = %s' % repr(environ['mod_wsgi.process_group']) 

    from django.core.handlers.wsgi import WSGIHandler
    _application = WSGIHandler()

    return _application(environ, start_response)

and the resulting log file always says:

mod_wsgi.process_group = ''

which, accroding to the documentation, indicates that daemon mode is not being used. I checked my setup multiple times, the versions of Apache, mod_wsgi and Python are matching and my setup is correct according to all the HOWTO's I've read out there. What could I be missing?

Best Answer

It turned out that a symlink wasn't set correctly so my config changes never loaded in Apache. Sorry for wasting your time, I thought I checked everything thoroughly before posting.

Related Topic