Apachelogin模式debug:
[Tue Dec 21 11:36:33 2010] [info] [client 1.53.149.114] mod_wsgi (pid=24831, process='mysite', application='mysite.com|'): Loading WSGI script '/home/anhtran/webapps/mysite.com/django.wsgi'. [Tue Dec 21 11:36:33 2010] [error] [client 1.53.149.114] Premature end of script headers: django.wsgi [Tue Dec 21 11:36:33 2010] [notice] child pid 24831 exit signal Segmentation fault (11) [Tue Dec 21 11:36:33 2010] [info] mod_wsgi (pid=24980): Attach interpreter ''.
我的conf文件:
WSGISocketPrefix /tmp/wsgi <VirtualHost *:80> ServerName mysite.com ServerAlias www.mysite.com ServerAdmin admin@mysite.com DocumentRoot /home/anhtran/webapps/mysite.com/public_html WSGIDaemonProcess mysite processes=5 threads=25 WSGIProcessGroup mysite WSGIScriptAlias / /home/anhtran/webapps/mysite.com/django.wsgi LogLevel debug <Directory /home/anhtran/webapps/mysite.com/mysite> Order allow,deny Allow from all </Directory> </VirtualHost>
Django在没有数据连接(如MySQLdb或sqlite3)的基本项目中工作正常。 我正在使用CentOS 5 64位,Apache 2.x,mod_wsgi 3.2。 我认为这不是Django的问题,但我不知道。 每个人都可以修复它? 帮我。 谢谢! 🙂
django.wsgi
#!/usr/local/bin/python import os, site, sys # add the virtual environment path site.addsitedir('/home/anhtran/webapps/mysite.com/env/lib/python2.6/site-packages') site.addsitedir('/home/anhtran/webapps/mysite.com/mysite') site.addsitedir('/home/anhtran/webapps/mysite.com') # fix markdown.py (and potentially others) using stdout sys.stdout = sys.stderr #Calculate the path based on the location of the WSGI script. project = os.path.dirname(__file__) workspace = os.path.dirname(project) sys.path.append(workspace) os.environ['PYTHON_EGG_CACHE'] = '/home/anhtran/webapps/mysite.com/.python-eggs' os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' from django.core.handlers.wsgi import WSGIHandler application = WSGIHandler()
我已阅读此链接中的一些问题: http : //code.google.com/p/modwsgi/wiki/FrequentlyAskedQuestions但我仍然不明白的解决scheme。
守护进程崩溃。 请参阅mod_wsgi FAQ中关于导致崩溃的注释:
http://code.google.com/p/modwsgi/wiki/FrequentlyAskedQuestions
并按照链接。
最终的原因可能有很多,包括同时加载不兼容的mod_python,使用不支持子解释器的Python C扩展模块,Apache使用的不兼容共享库版本和/或PHP中的扩展模块等。
最后,我找到了解决办法。 这是一个多Python版本的问题: http : //code.google.com/p/modwsgi/wiki/InstallationIssues#Multiple_Python_Versions 。
谢谢大家! :P
我在安装在虚拟机上的django,apache2,mod_wsgi,python2.6上有类似的问题。 我解决了分配给虚拟机的ram问题。
我希望这将有所帮助。
试着删除这个
WSGISocketPrefix /tmp/wsgi
和这个
WSGIDaemonProcess mysite processes=5 threads=25 WSGIProcessGroup mysite
在我的服务器上工作。
我得到这个相同的错误,虽然基本的原因可能是多个python版本,但我发现,这是由于从Django挂到我的MySQL服务器的查询。 如果我运行一个
show processlist;
在MySQL提示符下,我看到查询正在队列中备份。 如果我杀死顶部的查询,所有其他打开的进程立即完成,我的网站恢复生机。
希望这可以帮助别人。 你也可以运行
show full processlist;
看到确切的查询。 在我的情况下,这是一个Django select_related
查询,在查询中创建了大量的INNER JOIN
子句。
请参阅: http : //dev.mysql.com/doc/refman/5.1/en/show-processlist.html
我的同样的问题是这样解决的:删除有一天我添加的cgi配置:
AddHandler cgi-script .py