Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache hangs with mod_wsgi + django

I have had Apache + mod_wsgi + django running. For some reason, something has changed on the server and now apache completely hangs--it stops responding to all other requests and has to be stopped and started--when I post a request. Eventually we see a "Premature end of script headers: django.wsgi" error.

We did a strace and one thing I saw that seemed suspicious was "GATEWAY_INTERFACE\0CGI/1.1\0SERVER_PROTOCOL..." (We also see a shutdown being issued.)

Is "GATEWAY_INTERFACE\0CGI/1.1" specifying that it is set up for CGI rather then WSGI? (I have read that premature end of script can results if it is set as CGI.)

Our virtualhost specifies:

WSGIDaemonProcess [host] threads=25
WSGIProcessGroup [host]
WSGIScriptAlias / /path/to/apache/django.wsgi

and I see nothing to do with CGI in the httpd.conf just loading the WSGI module.

like image 676
user730379 Avatar asked Nov 15 '12 18:11

user730379


1 Answers

Here, try this one:

http://www.foxhop.net/django-virtualenv-apache-mod_wsgi

Remember to add python and project paths to syspath.

like image 133
arturex Avatar answered Oct 02 '22 21:10

arturex