Thanks everyone.  I finally decided to re-do my setup and it worked.

On Wednesday, 13 June 2012 16:04:35 UTC-5, Mike Orr wrote:
>
> On Wed, Jun 13, 2012 at 10:36 AM, Mark Huang <zhengha...@gmail.com> 
> wrote: 
> > Hi all, 
> > 
> > I recently transferred all my code to a production server and was trying 
> to start my application as another user.  I am using Debian and running as 
> root.  I entered the following command: 
> > 
> > pserve production.ini --user=www-data --group=www-data start 
> > 
> > This caused an import error: "No module named resource" 
> > 
> > I thought I didn't install the necessary packages to run my application 
> so I re downloaded everything again as root.  It still didn't work.  I'm 
> thinking if this has to do with a permissions issue, www-data user doesn't 
> have access to the modules in my virtual environment created by the root 
> user. 
> > 
> > However if I just run pserve production.ini start, I get no such errors. 
> Can anybody help me? 
>
> It sounds like you're on the right track. The virtualenv needs to be 
> readable by the user and/or group the program is running as. Even if 
> certain modules have already been imported by the time pserve drops 
> privileges, you'll still run into trouble with application 
> supplemental modules. 
>
> When you run 'pserve' without switching users, the virtualenv files 
> are readable, so the problem doesn't arise. 
>
> I set up my production directory like this: 
>
> data/   -- Real-time data files, readable/writeable by www-data. 
> apps/  -- Version-controlled application files, readable by www-data 
> static/  -- Non-version-controlled application files (maintained 
> manually or via cron jobs), readable by www-data. 
> venv/ -- Virtual environments, readable by www-data. 
>
> Each application has a subdirectory under these; e.g., data/app1/ . 
> That way the permissions are simple and easy to audit: everything gets 
> "normal" permissions except the 'data' directory. 
>
> -- 
> Mike Orr <sluggos...@gmail.com> 
>

-- 
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/-/3Rzi-yIZbf0J.
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.

Reply via email to