I installed up apache2 on Ubuntu and installed Django and mod_wsgi. I then created a virtual host in apache called mydomain.com and modified my hosts file to direct that address to 127.0.0.1 and finally, I tested my website by running python manage.py runserver and it is working. However, when I browse to http://mydomain.com instead, I get a 500 error page. Looking at apache error logs this is what I got:
[Wed Jan 30 20:53:31 2013] [error] [client 127.0.0.1] mod_wsgi (pid=2935): Exception occurred processing WSGI script '/var/django/mydomain/mydomain.wsgi'.
[Wed Jan 30 20:53:31 2013] [error] [client 127.0.0.1] Traceback (most recent call last):
[Wed Jan 30 20:53:31 2013] [error] [client 127.0.0.1] File "/usr/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 250, in __call__
[Wed Jan 30 20:53:31 2013] [error] [client 127.0.0.1] self.load_middleware()
[Wed Jan 30 20:53:31 2013] [error] [client 127.0.0.1] File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 39, in load_middleware
And here is the content of mydomain.wsgi
import os
import sys
sys.path.append('/var/django/mydomain')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mydomain.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
I do NOT have a file named mydomain.settings (should I create one?) and it is my first time using django. Please advise.
The value of DJANGO_SETTINGS_MODULE should be just
'settings'.