Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Dec 20, 2012 7:39 am 
Offline
Newbie

Joined: Thu Dec 20, 2012 7:28 am
Posts: 2
Set up Django, Apache and mod_wsgi on Debian 6 (Squeeze), per this guide:

http://library.linode.com/frameworks/dj ... -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 middleware_path in settings.MIDDLEWARE_CLASSES:
[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(settings_module)
[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['PYTHON_EGG_CACHE'] = '/srv/www/klkds.com/.python-egg'
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

---

Am I supposed to set the path for DJANGO_SETTINGS_MODULE to my settings.py file? It's located at: /srv/www/klkds.com/application/application/settings.py

Help much appreciated!


Top
   
PostPosted: Thu Dec 20, 2012 11:10 am 
Offline
Senior Member

Joined: Fri Feb 18, 2005 4:09 pm
Posts: 594
I keep the .wsgi file and the settings.py file in the same directory. Try moving the settings file to that location as a test.

James


Top
   
PostPosted: Thu Dec 20, 2012 5:28 pm 
Offline
Newbie

Joined: Thu Dec 20, 2012 7:28 am
Posts: 2
if you use a command "django-admin.py startproject mysite"

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


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group