I currently have 2 servers A and B, both running on Debian. Server A was setup 1 month ago with Gunicorn 1.4.3. I created a new linux user called 'web', with shell access and a home directory. The virutalenv is managed by virtualenvwrapper in the home directory. So what I would do to start my pyramid application would be to login as root and switch to the 'web' user (su - web) and run gunicorn like so:
However, this gave an error. I added the --log-level=debug into it and the error says:
2012-07-05 11:13:35 [29578] [INFO] Worker exiting (pid: 29578)
/paste/deploy/loadwsgi.py", line 296, in loadcontext
File "/root/.virtualenvs/rhino_env/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 320, in _loadconfig
File "/root/.virtualenvs/rhino_env/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 454, in get_context
File "/root/.virtualenvs/rhino_env/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 476, in _context_from_use
File "/root/.virtualenvs/rhino_env/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 406, in get_context
File "/root/.virtualenvs/rhino_env/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 296, in loadcontext
File "/root/.virtualenvs/rhino_env/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 328, in _loadegg
File "/root/.virtualenvs/rhino_env/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 620, in get_context
File "/root/.virtualenvs/rhino_env/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 646, in find_egg_entry_point
File "/root/.virtualenvs/rhino_env/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 1954, in load
File "/srv/web/prod/rhino/rhino/__init__.py", line 2, in <module>
from pyramid.config import Configurator
ImportError: No module named pyramid.config
The really weird thing is that, if I open up a python console within my virtualenv, I am able to import that module!! What's going on? I suspect it is permissions related or something and that I am unable to run Gunicorn as a non root user (without shell access).