2

我通过 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/supportusing中安装跟踪器,对其进行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 运行我的应用程序...

4

2 回答 2

2

根据这个问题,这是一个权限问题。使用解决:

WSGIDaemonProcess support.roundup user=roundup group=roundup threads=25
WSGIProcessGroup support.roundup

其中文件作为所有者和组/var/roundup/support/具有roundup适当的访问权限。

于 2012-09-17T14:07:24.083 回答
1

尝试:

from roundup.cgi.wsgi_handler import RequestDispatcher
tracker_home = '/var/roundup/support'
application = RequestDispatcher(tracker_home)

所有 mod_wsgi 需要的是一个“应用程序”对象,它是一个有效的 WSGI 应用程序入口点。

您不需要像您一直尝试的那样自己启动 WSGI 服务器或 FASTCGI 适配器。

于 2012-09-16T05:12:25.390 回答