Apache2 使用WSGI和Apache设置综述

Apache2 使用WSGI和Apache设置综述,apache2,debian,mod-wsgi,python-2.6,roundup,Apache2,Debian,Mod Wsgi,Python 2.6,Roundup,我是由Debian官方repo安装Roundup 1.4的,希望使用mod_wsgi在Apache服务器上运行它。主机配置: <VirtualHost *:80> ServerName support.domain.com WSGIScriptAlias / /var/roundup/support/apache/roundup.wsgi WSGIDaemonProcess support.roundup user=roundup group=roundup

我是由Debian官方repo安装Roundup 1.4的,希望使用
mod_wsgi
在Apache服务器上运行它。主机配置:

<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>
http://support.domain.com
(当然这个url有点不同)我有HTTP响应
500内部服务器错误
,并使用以下内容登录:

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运行我的应用程序…

试试:

from roundup.cgi.wsgi_handler import RequestDispatcher
tracker_home = '/var/roundup/support'
application = RequestDispatcher(tracker_home)
mod_wsgi需要的全部是一个“应用程序”对象,它是一个有效的wsgi应用程序入口点

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

根据这一点,这是一个权限问题。使用以下方法解决:

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

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

在我编写的上一次编辑上面,该编辑抛出运行时错误消息:
响应尚未启动
,但不知道原因。
WSGIDaemonProcess support.roundup user=roundup group=roundup threads=25
WSGIProcessGroup support.roundup