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?
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.