Setting up Django, Apache and mod_wsgi on Debian 6 (Squeeze)
Keep getting "500 Internal Server Error"
And this is what error-log looks like:
[Thu Dec 20 03:32:11 2012] [error] [client 99.113.35.235] mod_wsgi (pid=5742): Exception occurred processing WSGI script '/srv/www/klkds.com/application/django.wsgi'.
[Thu Dec 20 03:32:11 2012] [error] [client 99.113.35.235] Traceback (most recent call last):
[Thu Dec 20 03:32:11 2012] [error] [client 99.113.35.235] File "/usr/local/lib/python2.6/dist-packages/Django-1.4.3-py2.6.egg/django/core/handlers/wsgi.py", line 219, in call
[Thu Dec 20 03:32:11 2012] [error] [client 99.113.35.235] self.load_middleware()
[Thu Dec 20 03:32:11 2012] [error] [client 99.113.35.235] File "/usr/local/lib/python2.6/dist-packages/Django-1.4.3-py2.6.egg/django/core/handlers/base.py", line 39, in load_middleware
[Thu Dec 20 03:32:11 2012] [error] [client 99.113.35.235] for middlewarepath in settings.MIDDLEWARECLASSES:
[Thu Dec 20 03:32:11 2012] [error] [client 99.113.35.235] File "/usr/local/lib/python2.6/dist-packages/Django-1.4.3-py2.6.egg/django/utils/functional.py", line 184, in inner
[Thu Dec 20 03:32:11 2012] [error] [client 99.113.35.235] self._setup()
[Thu Dec 20 03:32:11 2012] [error] [client 99.113.35.235] File "/usr/local/lib/python2.6/dist-packages/Django-1.4.3-py2.6.egg/django/conf/init.py", line 42, in _setup
[Thu Dec 20 03:32:11 2012] [error] [client 99.113.35.235] self.wrapped = Settings(settingsmodule)
[Thu Dec 20 03:32:11 2012] [error] [client 99.113.35.235] File "/usr/local/lib/python2.6/dist-packages/Django-1.4.3-py2.6.egg/django/conf/init.py", line 95, in init
[Thu Dec 20 03:32:11 2012] [error] [client 99.113.35.235] raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
[Thu Dec 20 03:32:11 2012] [error] [client 99.113.35.235] ImportError: Could not import settings 'settings' (Is it on sys.path?): No module named settings
–-
My Django application is in folder: /srv/www/klkds.com/application/
This is what django.wsgi file looks like (saved in: /srv/www/klkds.com/application/django.wsgi):
import os
import sys
sys.path.append('/srv/www/klkds.com/application')
sys.path.append('/srv/www/klkds.com/')
os.environ['PYTHONEGGCACHE'] = '/srv/www/klkds.com/.python-egg'
os.environ['DJANGOSETTINGSMODULE'] = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
–-
Am I supposed to set the path for DJANGOSETTINGSMODULE to my settings.py file? It's located at: /srv/www/klkds.com/application/application/settings.py
Help much appreciated!
2 Replies
James
it will create two nested folders mysite/mysite/ where settings.py file will be located.
do you leave your settings.py file in: mysite/mysite/settings.py and also put django.wsgi file there?
or, do you put your django.wsgi file in: my site/django.wsgi and then move the automatically generated settings.py file from mysite/mysite/settings.py to mysite/settings.py ?
thanks for the clarification