Django - End of script output before headers

一个人想着一个人 提交于 2019-12-05 00:46:54

This is covered by the mod_wsgi documentation.

http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Python_Simplified_GIL_State_API

In short, you are likely using a Python extension module which is not implemented to work properly in a Python sub interpreter. That or the extension module is not releasing the GIL properly when doing blocking operations. Both can result in an interpreter deadlock.

Use the solution in the documentation and see if that helps.

raghavyadav990
<VirtualHost *:80>
    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>

I also had the same error and I have solved this issue by using this configuration.

Also add the following line to /etc/apache2/apache.config

#WSGIPythonPath /var/www/mysite

I am aware this thread is three years old but I stumbled across it when I had a similar issue so I thought I would add my solution. In my case it was something in the virtual environment that required mod_ssl to be enabled in Apache even though none of the sites used SSL (well they do but it is terminated elsewhere). So

a2enmod ssl
service apache2 restart

Fixed it.

After digging through the answers above. I had to set the number of processes from 5 to 1. Also using the multi worker mpm.

LoadModule mpm_worker_module modules/mod_mpm_worker.so
WSGIDaemonProcess music user=apache group=apache processes=1 threads=30  python-path=/srv/www/music/service/venv/lib/python2.7/site-packages
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!