FastCGI/Python线程/计时问题?

FastCGI/Python线程/计时问题?,python,fastcgi,flup,Python,Fastcgi,Flup,我在一个共享服务器上使用金字塔框架,该服务器不支持mod\u wsgi。部署项目后,我开始收到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] Prematur

我在一个共享服务器上使用金字塔框架,该服务器不支持
mod\u wsgi
。部署项目后,我开始收到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
我不太清楚到底发生了什么,在一次(部分)事故中,我用另一个使用sqlite连接而不是postgres连接的文件复制了我应用程序的
.ini
文件。突然,我的应用程序启动并运行了。然而,我注意到,似乎响应突然被切断(响应的结尾没有被刷新到客户端)

我一直在用头敲击键盘,想弄清楚到底发生了什么,所以我希望其他人也遇到过类似的症状,并找到了解决办法

我的fcgi条目如下所示(以防有任何帮助):


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

如果这是整个FASTCGI脚本文件,它是不完整的,因为没有#!用于Python解释器的行。
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()