9

I am trying to run my Django sites with mod_wsgi instead of mod_python (RHEL 5). I tried this with all my sites, but get the same problem. I configured it the standard way everyone recommends, but requests to the site simply time out.

Apache conf:

<VirtualHost 74.54.144.34>
    DocumentRoot /wwwclients/thymeandagain
    ServerName thymeandagain4corners.com
    ServerAlias www.thymeandagain4corners.com
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    CustomLog /var/log/httpd/thymeandagain_access_log combined
    ErrorLog /var/log/httpd/thymeandagain_error_log
    LogLevel error
    WSGIScriptAlias / /wwwclients/thymeandagain/wsgi_handler.py
    WSGIDaemonProcess thymeandagain user=admin group=admin processes=1 threads=16
    WSGIProcessGroup thymeandagain
</VirtualHost>

wsgi_handler.py:

import sys
import os

sys.path.append("/wwwclients")
os.environ['DJANGO_SETTINGS_MODULE'] = 'thymeandagain.settings'

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()

The daemon mod_wsgi is supposed to spawn off is not there, so requests just time out and I get a bunch of "Unable to connect to WSGI daemon process" errors in the logs. Is there something about the WSGIDaemonProcess directive that is preventing creation of the daemon? Thanks in advance for any help...

EDIT: I get this in the error log:

[[email protected]] mcm_server_readable():2582: timeout: Operation now in progress: select(2) call timed out for read(2)able fds
[[email protected]] mcm_get_line():1592
[[email protected]] mcm_server_readable():2582: timeout: Operation now in progress: select(2) call timed out for read(2)able fds
[[email protected]] mcm_get_line():1592
[Thu Nov 20 21:18:17 2008] [notice] caught SIGTERM, shutting down
[Thu Nov 20 21:18:18 2008] [notice] Digest: generating secret for digest authentication ...
[Thu Nov 20 21:18:18 2008] [notice] Digest: done
[Thu Nov 20 21:18:18 2008] [notice] mod_python: Creating 4 session mutexes based on 8 max processes and 64 max threads.
[Thu Nov 20 21:18:18 2008] [notice] Apache/2.2.3 (Red Hat) mod_python/3.2.8 Python/2.4.3 mod_wsgi/2.1-BRANCH configured -- resuming normal operations
2
  • Is there anything in the server's error log? I'd think it'd tell you there if there was a problem starting the WSGI daemon process. Commented Nov 19, 2008 at 17:42
  • This solved my problem blog.dscpl.com.au/2010/03/… Commented Sep 2, 2011 at 3:52

3 Answers 3

10

The real problem is permissions on Apache log directory. It is necessary to tell Apache/mod_wsgi to use an alternate location for the UNIX sockets used to communicate with the daemon processes. See:

http://code.google.com/p/modwsgi/wiki/ConfigurationIssues#Location_Of_UNIX_Sockets

Sign up to request clarification or add additional context in comments.

2 Comments

This was my problem exactly; running CentOS 6 with mostly-stock httpd.conf, I didn't have mod_python loaded (like another answer suggested), but configuring WSGISocketPrefix and appropriate permissions on the socket directory fixed it!
This was my problem too. I'm running on RHEL6 and adding WSGISocketPrefix /var/run/wsgi to the httpd.conf fixed it.
4

The problem is that mod_python doesn't go well together with mod_wsgi. I got into similar issue few weeks ago and everything started working for me shortly after I commented out mod_python inclusion.

Try to search modwsgi.org wiki for "mod_python", I believe there was someone talking about this somewhere in comments

Comments

1

Here is very detailed description on how to integrate django with mod_wsgi.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.