所以,类似于this question,我似乎无法让Pyramid和mod_wsgi达成一致,足以托管我的申请。
这是我的虚拟主机
LoadModule proxy_module modules/mod_proxy.so
WSGIPythonHome /usr/local/pythonenv/BASELINE
WSGIPythonPath /usr/local/pythonenv/BASELINE
<VirtualHost *:80>
ProxyPreserveHost On
ServerName domain.com
ServerAdmin me@domain.com
ErrorLog /home/me/log/error.log
CustomLog /home/me/log/access.log combined
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
WSGIDaemonProcess pyramid user=www-data group=www-data \
processes=1 threads=4 \
python-path=/var/app/app/appenv/lib/python2.7/site-packages
WSGIScriptAlias / /var/app/app/dispatch.wsgi
<Directory /var/app/app/>
WSGIProcessGroup pyramid
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
我的dispatch.wsgi看起来像这样:
activate_this = '/var/app/app/appenv/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
import os
os.environ['PYTHON_EGG_CACHE'] = '/var/app/app/dist'
# Load the Pylons application
from pyramid.paster import get_app, setup_logging
ini_path = '/var/app/app/development.ini'
setup_logging(ini_path)
application = get_app(ini_path, 'main')
我甚至得到了同样的错误:
[Tue May 06 11:45:54 2014] [error] [client xxx.xx.xx.xxx] mod_wsgi (pid=8156): Target WSGI script '/var/app/app/dispatch.wsgi' cannot be loaded as Python module.
[Tue May 06 11:45:54 2014] [error] [client xxx.xx.xx.xxx] mod_wsgi (pid=8156): Exception occurred processing WSGI script '/var/app/app/dispatch.wsgi'.
[Tue May 06 11:45:54 2014] [error] [client xxx.xx.xx.xxx] Traceback (most recent call last):
[Tue May 06 11:45:54 2014] [error] [client xxx.xx.xx.xxx] File "/var/app/app/dispatch.wsgi", line 9, in <module>
[Tue May 06 11:45:54 2014] [error] [client xxx.xx.xx.xxx] from pyramid.paster import get_app, setup_logging
[Tue May 06 11:45:54 2014] [error] [client xxx.xx.xx.xxx] File "/usr/local/lib/python2.7/dist-packages/pyramid/paster.py", line 3, in <module>
[Tue May 06 11:45:54 2014] [error] [client xxx.xx.xx.xxx] from paste.deploy import (
[Tue May 06 11:45:54 2014] [error] [client xxx.xx.xx.xxx] ImportError: No module named paste.deploy
权限也应该没问题:
-rwxr-xr-x 1 me me 458 May 5 14:42 dispatch.wsgi
从金字塔试图在/ usr / local / lib中使用贴纸的事实来看,在我看来,由于某种原因,它只是没有找到特定于我的应用程序的virtualenv。有什么想法吗?
值得注意的是,服务器上运行的另一个mod_wsgi应用程序未处于守护进程模式。这会干扰吗?