Django WSGI应用程序故障
因此,我通过Apache2.22在mod_wsgi中使用django wsgi应用程序获得了SEGFULTS 以下是wsgi应用程序:Django WSGI应用程序故障,django,apache,segmentation-fault,python-2.7,mod-wsgi,Django,Apache,Segmentation Fault,Python 2.7,Mod Wsgi,因此,我通过Apache2.22在mod_wsgi中使用django wsgi应用程序获得了SEGFULTS 以下是wsgi应用程序: import os import sys sys.path.append('/home/***.com/zpencerq') sys.path.append('/home/***.com/zpencerq/part') os.environ['DJANGO_SETTINGS_MODULE'] = 'part.settings' import django.
import os
import sys
sys.path.append('/home/***.com/zpencerq')
sys.path.append('/home/***.com/zpencerq/part')
os.environ['DJANGO_SETTINGS_MODULE'] = 'part.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
以下是日志中的错误:
[Mon Jun 18 18:13:39 2012] [info] mod_wsgi (pid=78535): Create interpreter 'www.***.com|'.
[Mon Jun 18 18:13:39 2012] [info] [client 128.227.57.184] mod_wsgi (pid=78535, process='***', application='www.***.com|'): Loading WSGI script '/usr/home/***.com/zpencerq/part/apache/django.wsgi'.
[Mon Jun 18 18:13:39 2012] [error] [client 128.227.57.184] Premature end of script headers: django.wsgi
[Mon Jun 18 18:13:40 2012] [notice] child pid 78535 exit signal Segmentation fault (11)
以下是mod_wsgi的库参考:
root@seese# ldd /usr/local/apache/modules/mod_wsgi.so
/usr/local/apache/modules/mod_wsgi.so:
libpython2.7.so.1 => /usr/local/lib/libpython2.7.so.1 (0x28300000)
libutil.so.7 => /lib/libutil.so.7 (0x2819f000)
libm.so.5 => /lib/libm.so.5 (0x281ac000)
libc.so.7 => /lib/libc.so.7 (0x28080000)
libthr.so.3 => /lib/libthr.so.3 (0x281c1000)
以下是加载的模块:
Loaded Modules:
core_module (static)
authn_file_module (static)
authn_default_module (static)
authz_host_module (static)
authz_groupfile_module (static)
authz_user_module (static)
authz_default_module (static)
auth_basic_module (static)
include_module (static)
filter_module (static)
deflate_module (static)
log_config_module (static)
env_module (static)
setenvif_module (static)
version_module (static)
mpm_prefork_module (static)
http_module (static)
mime_module (static)
status_module (static)
autoindex_module (static)
asis_module (static)
suexec_module (static)
cgi_module (static)
negotiation_module (static)
dir_module (static)
actions_module (static)
userdir_module (static)
alias_module (static)
so_module (static)
php5_module (shared)
wsgi_module (shared)
Syntax OK
以下是编译模块:
root@seese# httpd -l
Compiled in modules:
core.c
mod_authn_file.c
mod_authn_default.c
mod_authz_host.c
mod_authz_groupfile.c
mod_authz_user.c
mod_authz_default.c
mod_auth_basic.c
mod_include.c
mod_filter.c
mod_deflate.c
mod_log_config.c
mod_env.c
mod_setenvif.c
mod_version.c
prefork.c
http_core.c
mod_mime.c
mod_status.c
mod_autoindex.c
mod_asis.c
mod_suexec.c
mod_cgi.c
mod_negotiation.c
mod_dir.c
mod_actions.c
mod_userdir.c
mod_alias.c
mod_so.c
以下是一些python产品:
root@seese# ls -l /usr/local/bin/python*
lrwxr-xr-x 1 root wheel 7 Jun 17 13:30 /usr/local/bin/python -> python2
lrwxr-xr-x 1 root wheel 14 Jun 17 13:30 /usr/local/bin/python-config -> python2-config
-r-xr-xr-x 1 root wheel 3420 Mar 6 01:22 /usr/local/bin/python-shared2.7
-r-xr-xr-x 1 root wheel 1631 Mar 6 01:22 /usr/local/bin/python-shared2.7-config
lrwxr-xr-x 1 root wheel 9 Jun 17 13:30 /usr/local/bin/python2 -> python2.7
lrwxr-xr-x 1 root wheel 16 Jun 17 13:30 /usr/local/bin/python2-config -> python2.7-config
-rwxr-xr-x 1 root wheel 8084 Jun 17 13:30 /usr/local/bin/python2.7
-rwxr-xr-x 1 root wheel 1624 Jun 17 13:30 /usr/local/bin/python2.7-config
我已经在这里呆了很长一段时间了,哈哈,我对随之而来的许多头痛感到非常沮丧。如果有人(也许是格雷厄姆·邓普尔顿!)能帮我解决这个问题,那就太棒了
问:为什么当针对WSGI应用程序发出第一个请求时
Apache服务器进程使用“分段”处理请求崩溃
错误'
答:这几乎总是由共享库版本引起的
冲突。也就是说,Apache或某些Apache模块是针对
与用户正在使用的库版本不同的库版本
WSGI应用程序使用的特定Python模块。这个
最常见的罪魁祸首是expat和MySQL库,但它可以
其他共享库也会出现这种情况
仅在第一次请求时导致进程崩溃的另一个原因可能是
Python的第三方C扩展模块,尚未安装
实现以便在辅助Python子解释器中工作。
Subversion的Python绑定是一个特殊的示例,其中
Python模块仅在强制WSGI应用程序时才能正常工作
在Python创建的第一个解释器实例中运行
有关这些问题的更多信息可在各个章节中找到
应用程序问题的定义。外派图书馆的问题也很严重
在《外籍人士图书馆》杂志上进行了更详细的讨论
我看到您在/usr/local/
上安装了Apache和Python,所以我假设您已经编译了它们。您必须确保代码中使用的C扩展也链接到正确的版本。另一个选项是,您正在使用一些有缺陷的模块,当通过mod_wsgi加载时,这些模块的性能很差
你能在没有mod_wsgi的情况下运行你的应用程序吗,比如运行
/manage.py
?特别是,我不知道你说的C扩展是什么意思:/比如说哪个C扩展?是的,我可以在没有mod_wsgi的情况下运行应用程序;将其移动到生产就绪的服务器。而WSGIApplicationGroup的格雷厄姆并没有改变任何事情。当我重新启动Apache时,日志中会显示“mod_wsgi已在运行,正在跳过”,这有关系吗?还是我需要终止这些进程?