【发布时间】:2012-05-16 12:41:43
【问题描述】:
我有一个 Python WSGI 应用程序,我用 apache2 + mod_wsgi 在嵌入式模式下编写并运行它,我正试图让它在守护程序模式下运行。
问题是,通过配置(如下),我看到的不是应用程序,而是默认的 Apache2 “它可以工作!”该页面尽管热心地陈述其运营状态,但却是错误的。
我只清理了 appname 和 urls 等,所以你会看到我正在使用的整个 apache conf。
<VirtualHost *:80>
ServerName app.example.com
ServerAlias app
WSGIDaemonProcess appname user=www-data group=www-data processes=5 threads=5 display-name=%{GROUP} maximum-requests=1000
WSGIScriptAlias / /usr/share/app/app/application.wsgi
Alias /static /usr/share/app/app/static
ErrorLog /var/log/apache2/app/error.log
CustomLog /var/log/apache2/app/access.log common
<Directory /usr/share/app/app>
WSGIProcessGroup appname
Order allow,deny
Allow from All
</Directory>
<Directory /usr/share/app/app/static>
Order allow,deny
Allow from All
</Directory>
</VirtualHost>
无论我将 WSGIProcessGroup 选项放在该部分中,还是仅在主部分中,这仍然只是显示“它有效!”页面。
该应用程序使用了 bottle 和 toscwidgets,并带有 wsgi 验证器来确保它的行为良好。我用来构建应用程序的代码:
import bottle
import tw.api
from wsgiref.validate import validator
#.... A whole buttload of code
application = bottle.default_app()
application = tw.api.make_middleware(application, stack_registry=True)
application = validator(application)
编辑:我还想指出,我在带有 Python 2.6.5 的 mod_wsgi 2.8 和带有 Python 2.7.3 的 mod_wsgi 3.3 中都遇到了这个问题。
编辑 2: /static/ 的别名仍然有效,所以我似乎仍然在访问 VirtualHost。如果我注释掉 WSGIProcessGroup 指令并重新启动 apache,它将运行良好,但在嵌入模式而不是守护进程模式下。
【问题讨论】:
-
你读过“它有效!”页面?
标签: python apache mod-wsgi bottle