我通过 Debian Squeeze 官方 repo 安装了 Roundup 1.4,并希望在我的 Apache 服务器上使用mod_wsgi
. 主机配置:
<VirtualHost *:80>
ServerName support.domain.com
WSGIScriptAlias / /var/roundup/support/apache/roundup.wsgi
WSGIDaemonProcess support.roundup user=roundup group=roundup threads=25
WSGIProcessGroup support.roundup
<Directory /var/roundup/support>
<Files roundup.wsgi>
Order allow,deny
Allow from all
</Files>
</Directory>
# ... some logging configuration
</VirtualHost>
我在/var/roundup/support
using中安装跟踪器,对其进行roundup-admin install
配置,然后使用roundup-admin initialise
. 然后我被创建了apache/roundup.wsgi
:
from roundup.cgi.wsgi_handler import RequestDispatcher
tracker_home = '/var/roundup/support'
application = RequestDispatcher(tracker_home)
当打开我的网站时http://support.domain.com
(当然这个网址有点不同),我有 HTTP 响应500 Internal Server Error
并登录:
mod_wsgi (pid=17433): Exception occured processing WSGI script '/var/roundup/support/apache/roundup.wsgi'.
RuntimeError: response has not been started
这是怎么回事?如何正确运行 wsgi(不是 cgi)的综述?或者在哪里查看为什么没有开始响应?
编辑
Roundup 的安装手册说 wsgi 处理程序看起来像这样:
from wsgiref.simple_server import make_server
# obtain the WSGI request dispatcher
from roundup.cgi.wsgi_handler import RequestDispatcher
tracker_home = 'demo'
app = RequestDispatcher(tracker_home)
httpd = make_server('', 8917, app)
httpd.serve_forever()
但这没有任何反应。浏览器永远加载它而没有消息或服务器日志。我认为从 apache 模块运行的脚本启动另一台服务器并不是一个好主意。所以我尝试了另一个代码示例:
from roundup.cgi.wsgi_handler import RequestDispatcher
tracker_home = '/var/roundup/support'
application = RequestDispatcher(tracker_home)
from flup.server.fcgi import WSGIServer
WSGIServer(application).run()
但这会引发一些错误,例如:
WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
必须有一种方法可以从 RequestDispatcher 运行我的应用程序...