简体   繁体   English

在mod_wsgi下运行Django站点

[英]Running a Django site under mod_wsgi

I am trying to run my Django sites with mod_wsgi instead of mod_python (RHEL 5). 我试图用mod_wsgi而不是mod_python(RHEL 5)运行我的Django站点。 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: 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: 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. 守护进程mod_wsgi应该产生不存在,所以请求只是超时,我在日志中得到了一堆“无法连接到WSGI守护程序进程”错误。 Is there something about the WSGIDaemonProcess directive that is preventing creation of the daemon? 有没有关于WSGIDaemonProcess指令阻止创建守护进程的东西? Thanks in advance for any help... 在此先感谢任何帮助......

EDIT: I get this in the error log: 编辑:我在错误日志中得到这个:

[WARN@1227228322.174175] mcm_server_readable():2582: timeout: Operation now in progress: select(2) call timed out for read(2)able fds
[INFO@1227228322.174263] mcm_get_line():1592
[WARN@1227227903.249626] mcm_server_readable():2582: timeout: Operation now in progress: select(2) call timed out for read(2)able fds
[INFO@1227227903.249712] 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

The real problem is permissions on Apache log directory. 真正的问题是Apache日志目录的权限。 It is necessary to tell Apache/mod_wsgi to use an alternate location for the UNIX sockets used to communicate with the daemon processes. 有必要告诉Apache / mod_wsgi使用用于与守护进程通信的UNIX套接字的备用位置。 See: 看到:

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

The problem is that mod_python doesn't go well together with mod_wsgi. 问题是mod_python与mod_wsgi不能很好地结合在一起。 I got into similar issue few weeks ago and everything started working for me shortly after I commented out mod_python inclusion. 几周前我遇到了类似的问题,在我评论出mod_python包含后不久我就开始为我工作了。

Try to search modwsgi.org wiki for "mod_python", I believe there was someone talking about this somewhere in comments 尝试搜索modwsgi.org wiki中的“mod_python”,我相信在评论中有人在谈论这个

这里有关于如何将django与mod_wsgi集成的非常详细的描述。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM