No module named deploy when trying to start pyramid app with mod_wsgi

谁都会走 提交于 2019-12-04 10:51:25

Solved it finally. From the console log it's obvious that my main python installation in /usr/local/lib has a paste module installed that does not have deploy handler defined.

RedBaron's comment to set WSGIPythonHome worked, but the problem is I have multiple apps so I cannot just point WSGIPythonHome globally to a specific app's virtualenv.

Anyhow, I went through mod_wsgi docs on virtualenv again (https://code.google.com/p/modwsgi/wiki/VirtualEnvironments#Baseline_Environment) and saw that WSGIPythonHome should be pointing to a "virgin environment". literally

$ virtualenv --no-site-packages BASELINE

and then pointing WSGIPythonHome

WSGIPythonHome /usr/local/pythonenv/BASELINE

and point WSGIDaemonProcess to my app's specific virtualenv (which I already did at the beginning)

LESSON LEARNT: Pay more attention to the docs...


Finally, my pyramid.wsgi can be greatly simplified to only the following

import os
os.environ['PYTHON_EGG_CACHE'] = '/data/app/python-eggs'

from pyramid.paster import get_app, setup_logging
ini_path = '/data/app/app/development.ini'
setup_logging(ini_path)
application = get_app(ini_path, 'main')

In my case reinstalling PasteDeploy in the virtual environment fixed the problem, not sure why though.

The error would indicate that the PasteDeploy package is not installed.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!