Django在头之前结束脚本输出

2024-06-10 20:01:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我的一台服务器将定期停止提供内容,Vhost错误日志中会发现以下错误:

[Mon Feb 02 10:27:41.692362 2015] [core:error] [pid 13013] [client xxx.xxx.xxx.xxx:41537] End of script output before headers: wsgi.py
[Mon Feb 02 10:27:41.692365 2015] [core:error] [pid 13025] [client xxx.xxx.xxx.xxx:41188] End of script output before headers: wsgi.py
[Mon Feb 02 10:27:41.692423 2015] [core:error] [pid 14787] [client xxx.xxx.xxx.xxx:36388] End of script output before headers: wsgi.py
[Mon Feb 02 10:27:41.692451 2015] [core:error] [pid 12994] [client xxx.xxx.xxx.xxx:38770] End of script output before headers: wsgi.py

在此之后,apache锁定并停止提供内容。帮助最感激的人。在

在wsgi.py公司名称:

^{pr2}$

主机:

WSGIScriptAlias / /var/www/vhosts/zipper/src/core/wsgi.py
WSGIDaemonProcess zipper python-path=/var/www/vhosts/zipper/src:/var/www/vhosts/.virtualenvs/zipper/lib/python2.7/site-packages
WSGIProcessGroup zipper

<Directory /var/www/vhosts/zipper/src/>
    <Files wsgi.py>
         Require all granted
    </Files>
</Directory>

编辑#1

Django版本:1.6.4 Mod_WSGI版本:3.4-4ubuntu2.1.14.04.2


Tags: ofpycoreclientwsgioutputscripterror
2条回答

尝试添加指令:

WSGIApplicationGroup%{GLOBAL}

在WSGIProcessGroup行之后。在

带有C扩展组件的各种第三方Python包存在已知的问题,这意味着它们不能正确地与Python子解释器一起工作。该指令强制应用程序在主解释器上下文中运行。这样的模块就很幸福了。在

ServerName localhost
ServerAlias localhost
ServerAdmin raghav@xyz.com

<Directory /var/www/mysite/mysite>
AddHandler wsgi-script .py
Options +ExecCGI
</Directory>

DocumentRoot /var/www/mysite
WSGIDaemonProcess myproject python-path=/var/www/mysite:/var/www/environ/lib/python2.7/site-packages
#WSGIProcessGroup mysite
WSGIScriptAlias / /var/www/mysite/mysite/wsgi.py

WSGIApplicationGroup %{GLOBAL}

<Directory /var/www/mysite/mysite/>
order deny,allow
Allow from all
</Directory>

我也得到同样的问题后,阅读了几个博客,这个配置为我工作。 试试这个

相关问题 更多 >