Ubuntu upgrade broke django mod_wsgi

apache-2.2djangomod-wsgiubuntu-14.04

I'm banging my head here and can't seem to find the answers anywhere.

My server is running Ubuntu 14.04. I run several django sites using apache and mod_wsgi Today after an update, the sites will not work.

I can see that libapache2-mod-wsgi:amd64 (3.4-4ubuntu2.1.14.04.1, 3.4-4ubuntu2.1.14.04.2) is one of the updates

This error is appearing in the apache error log

mod_wsgi (pid=6624): Failure to configure the daemon process correctly and
  process left in unspecified state. Restarting daemon process after delay.

Whilst this one appears in a specific django app log

Fatal Python error: PyEval_AcquireThread: NULL new thread state
<...>
Script timed out before returning headers: wsgi.py

I can't remember if I install mod_wsgi using pip or not.

Any pointers would be great.

Best Answer

Just in case you haven't solved this yet:

In mod_wsgi 2.0+, you need to specify the home directory if using the WSGIDaemonProcess directive. In my case I was using a user without a home directory, and that was causing the same error you saw.

home=directory

Defines an absolute path of a directory which should be used as the initial current working directory of the daemon processes within the process group. If this option is not defined, in mod_wsgi 1.X the current working directory of the Apache parent process will be inherited by the daemon processes within the process group. Normally the current working directory of the Apache parent process would be the root directory. In mod_wsgi 2.0+ the initial current working directory will be set to be the home directory of the user that the daemon process runs as.

https://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIDaemonProcess