Sorry for a noob question: "How do I import the module as user www-data when the user doesn't even have shell access?" Does this mean I have to give this user a shell like /bin/bash?
"Could it be for any reason, that your user www-data either has wrong environment variables set or has no read access to this module?" Because I am running the virtual environment as the root user, does this mean that when I start gunicorn paster, the www-data user is unable to access the modules in the virtual environment site-packages? Currently the virtual environment, being created by the root user, has root:root permissions. On Thursday, 5 July 2012 00:22:20 UTC-5, cornelius wrote: > > Hi Mark, > > So probably your user www-data can not find the pyramid.config module. > Try to import the module as user www-data. > > Could it be for any reason, that your user www-data either has wrong > environment variables set or has no read access to this module? > > Kind regards > Cornelius > > > > Am 05.07.2012 um 05:32 schrieb Mark Huang <zhengha...@gmail.com>: > > Hi Everyone, > > 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: > > gunicorn_paster -w 5 -t 80 --log-file=/somewhere/with/logs -D > production.ini > > This works! > > Server B was setup yesterday. It is using Gunicorn 1.4.5. My boss wants > me to use the default www-data user and group instead of creating a > separate user and group. So I created my virtualenv to run my pyramid > application as the 'root' user. All of my code and logs live in the /srv > directory and sub-directories. I gave chown-ed the srv directory with > www-data:www-data. Now....when I run gunicorn paster, I had to specify a > user and group to run as using the '-u' and '-g' flag as stated in their > documentation <http://gunicorn.org/configure.html#user>: > > gunicorn_paster -w 5 -t 80 --log-file=/somewhere/with/logs -u > www-data -g www-data -D production.ini > > 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). > > Regards, > Mark Huang > > > -- > You received this message because you are subscribed to the Google Groups > "pylons-discuss" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/pylons-discuss/-/8Tjcpoufp5AJ. > To post to this group, send email to pylons-discuss@googlegroups.com. > To unsubscribe from this group, send email to > pylons-discuss+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/pylons-discuss?hl=en. > > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To view this discussion on the web visit https://groups.google.com/d/msg/pylons-discuss/-/MdUWUI3SR94J. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.