I am having problems setting up wgsi with django. I'm following this http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/ . Yet I am still really confused as to where to put the .wsgi file and if I need to set the sys.path. I have tried it both directly outside and inside the web root and I can't get anything to work as expected.
# /home/ben/public_html/django_test/testproject/apache/django.wsgi:
import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'testproject.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
Relivant apache conf:
DocumentRoot "/home/ben/public_html/django_test/testproject/"
WSGIScriptAlias / "/home/ben/public_html/django_test/testproject/apache/django.wsgi"
Apache Logs Error (standard apache 500 page):
ImportError: Could not import settings 'testproject.settings' (Is it on sys.path? ...
I can at get django to at least throw an error of it's own by using this:
import os
import sys
path = '/home/ben/public_html/django_test/testproject'
if path not in sys.path:
sys.path.append(path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
which resulted in this django error page:
ImportError at /admin/
No module named testproject.urls