1

我在mod_wsgi不支持的共享服务器上使用 Pyramid 框架。部署项目后,我开始收到 500 个错误,但没有真正有用的错误消息:

[Thu Sep 22 21:40:52 2011] [warn] [client IP] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Thu Sep 22 21:40:52 2011] [error] [client IP] Premature end of script headers: dispatch.fcgi
[Thu Sep 22 21:40:53 2011] [warn] [client IP] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Thu Sep 22 21:40:53 2011] [error] [client IP] Premature end of script headers: dispatch.fcgi

我不太确定发生了什么,在一次(部分)事故中,我.ini用另一个使用 sqlite 连接而不是 postgres 连接的应用程序文件复制了我的应用程序文件。突然,我的应用程序启动并运行。但是,我注意到响应似乎突然被切断了(响应的结尾没有被刷新到客户端)。

我一直在用头撞键盘,试图弄清楚发生了什么,所以我希望其他人也遇到过类似的症状并找到了解决方案。

我的 fcgi 条目看起来像这样(如果它有帮助的话):

app = "/dir"
inifile = "production.ini"

import sys, os
sys.path.insert(0, app)
from paste.deploy import loadapp

wsgi_app = loadapp("config:%s/%s" % (app, inifile))

if __name__ == "__main__":
        from flup.server.fcgi import WSGIServer
        WSGIServer(wsgi_app).run()

我记得在某处看到过一篇帖子,建议在单独的线程中启动 WSGI 服务器,让主线程休眠一段时间,但这对我来说似乎是一个可怕的 hack。

4

0 回答 0