views:

117

answers:

1

I'm a noob but I made my application work beautifully using python manage.py runserver but when I brought it to Apache + mod_wsgi, I keep getting this error. The debug messages aren't much help. Here is a screenshot of the entire debug image: http://img694.imageshack.us/img694/6723/screenshotfb.png

Here is the dump of my http.conf file.

WWSGIDaemonProcess cloud-tester python-path=/home/ubuntu/.virtualenvs/pinax-env/lib/python2.6/site-packages
WSGIProcessGroup cloud-tester

WSGIScriptAlias /cloudrunner /home/ubuntu/projects/cloudfly/deploy/pinax.wsgi
<Directory /home/ubuntu/projects/cloudfly/deploy>
    Order deny,allow
    Allow from all
</Directory>

The contents of pinax.wsgi is what comes with Pinax. I didn't change anything.

I created a sample "basic_project", and that works fine. This doesn't.

Thanks in advance! Any advice on what I should do?

+4  A: 

Under Apache/mod_wsgi your code will run as Apache user and will not usually have access rights to write to directories that you as a user has. Read:

http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Access_Rights_Of_Apache_User

The easiest way around that is run make the daemon process run as same user as you manually run the code. Use the 'user/group' options to WSGIDaemonProcess for this purpose. Read:

http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIDaemonProcess

A further problem may be that you have used relative pathnames in your code. This will not work under Apache as the current working directory could be anything. You should really always use absolute path names, or at least calculate them relative to os.path.dirname() of __file__ for the code file it is being done in.

A way around this if you really don't want to deal with it, is to use the 'home' option to WSGIDaemonProcess to set current working directory of daemon process to same directory where you are running server by hand. See same documentation for WSGIDaemonProcess referenced above.

Graham Dumpleton
I tried both suggestions that you said. No luck. Here is my pinax.wsgi file: http://www.copypastecode.com/22518/Here is my httpd.conf: http://www.copypastecode.com/22522/My project is located in /home/ubuntu/projects/cloudfly.Thanks for your help!
David Daniel
Try 'home=/home/ubuntu/projects/cloudfly'. That is the directory that run server uses as current working directory, not your deploy sub directory.
Graham Dumpleton