Florian Ledermann
Florian Ledermann

Reputation: 3537

Apache/mod_wsgi daemon mode not working

I have problems getting mod_wsgi to run in daemon mode on my Debian/Apache/Python2.6/Django setup. 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?


Edit: FYI my application is running fine in embedded mode, I just wanted to switch to daemon mode and found out it is not activated using the wsgi script above.

Upvotes: 1

Views: 2587

Answers (2)

Florian Ledermann
Florian Ledermann

Reputation: 3537

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.

Upvotes: 2

danodonovan
danodonovan

Reputation: 20373

The line mod_wsgi.process_group = '' implies that you are still operating in embedded mode (as you note). mod_wsgi daemon mode will not work on Apache 1.x so I assume that you are running 2.x (as you also note).

You could try setting the apache

LogLevel info

so that there is more helpful information in the log file. I'm also assuming that you've forced apache to restart

# /etc/init.d/apache2 restart

this shouldn't be necessary in daemon mode so much, but if you were in embedded mode previously you will need to reload your config files.

Upvotes: 0

Related Questions