无法让金字塔与mod_wsgi一起使用

时间:2011-07-15 07:28:19

标签: apache mod-wsgi pyramid

我有一个金字塔应用程序和带有mod_wsgi的apache,我正在尝试让它们一起工作。这是我的httpd.conf:

ServerRoot "/home/user/webapps/myapp/apache2"
LoadModule dir_module        modules/mod_dir.so
LoadModule env_module        modules/mod_env.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module       modules/mod_mime.so
LoadModule rewrite_module    modules/mod_rewrite.so
LoadModule setenvif_module   modules/mod_setenvif.so
LoadModule wsgi_module       modules/mod_wsgi.so
LoadModule authz_host_module modules/mod_authz_host.so

LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combinedCustomLog /home/user/logs/user/access_myapp.log combined
ErrorLog /home/user/logs/user/error_myapp.log
KeepAlive Off
Listen 41121   
MaxSpareThreads 3
MinSpareThreads 1
ServerLimit 1
SetEnvIf X-Forwarded-SSL on HTTPS=1
ThreadsPerChild 5   
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
WSGIDaemonProcess myapp processes=1 display-name=%{GROUP} python-path=/home/user/webapps/myapp/htdocs/lib/python2.4/site-packages/ threads=4

WSGIScriptAlias / /home/user/webapps/myapp/htdocs/pyramid.wsgi

<Directory /home/user/webapps/myapp/htdocs>
        WSGIProcessGroup myapp
        Order allow,deny
        Allow from all    
</Directory>

不幸的是,我收到服务器错误:AssertionError:EvalException中间件在多进程环境中不可用

我按照this教程查看this帖子,但无法真正做到这一点。

谢谢!

2 个答案:

答案 0 :(得分:4)

从WSGIDaemonProcess中删除'processes = 1'选项。也就是说,让它默认为单个进程,不要显式设置它。任何使用'processes'选项都会导致'wsgi.multiprocess'被设置为True,这不是你想要的。请参阅以下文档中的“过程”选项文档:

http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIDaemonProcess

答案 1 :(得分:1)

您必须在您的部署设置中禁用调试模式