problem with deploying django application on mod_wsgi
Solution 1
Well, it seems that i made a mistake in my spelling of 'application' in django.wsgi. I discovered the following error in /etc/log/apache2/error.log (for ubuntu) (i didn't figure out how to read the error log before):
[DATE] [error] [client IP] mod_wsgi (pid=15912): Target WSGI script '/home/jason/faq/faq/apache/django.wsgi' does not contain WSGI application 'application'.
After that is changed, everything is well. Then I tested to see about the permission thing, it appears that as long as i keep the apache/django.wsgi where apache can see it, it'll be fine (i change it to 777 for now).
Solution 2
Does the user that Apache runs as have access to read directories/files out of your personal account? Have a read of:
http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Access_Rights_Of_Apache_User
In other words, a permissions problem.
Related videos on Youtube
FurtiveFelon
I am currently a student of Computer Science at the University of Waterloo.
Updated on September 17, 2022Comments
-
FurtiveFelon over 1 year
I was just trying to figure out how to configure django to work in a test production environment. I'm following both the tutorial on django doc on deployment and the mod_wsgi guide to django integration. No matter what i do, all i get is page not found (404 error), before if I comment out the modification to httpd.conf, it works fine and i get the test page, so the basics are correct.
Here are the relevant modifications i made: In the folder where manage.py and settings.py reside for the site, i made a folder called apache and inside that i created a file called django.wsgi. In the file is the following:
import os import sys sys.path.append('/home/jason/faq') sys.path.append('/home/jason/faq/faq') os.environ['DJANGO_SETTINGS_MODULE'] = 'faq.settings' import django.core.handlers.wsgi applicaion = django.core.handlers.wsgi.WSGIHandler()
jason/faq/faq is where manage.py and settings.py reside. In httpd.conf:
WSGIScriptAlias / /home/jason/faq/faq/apache/django.wsgi <Directory /home/jason/faq/faq/apache> Order deny, allow Allow from all </Directory>
Which is copied directly from the tutorial on mod_wsgi site.
If I run python manage.py runserver, it works fine for local host. I have no idea what could be wrong, if you need more information, please tell me where to get it, i am almost a complete newbie in regards to server administration tasks.
Thank you very much for all your help!
-
FurtiveFelon over 14 yearsWell, i tried changing permissions on apache and apache/django.wsgi to 777. I also tried moving everything over to /usr/local/django and changing the permission there to 777 (also moving all of the references). It appears to not be doing anything. Perhaps there is a way of seeing what apache is doing? thanks a lot!
-
Graham Dumpleton over 14 yearsUsing 777 is generally a very bad idea as it means any user on the system can write to the directories.