Configuration problems with django and mod_wsgi

Posted by Jimbo on Stack Overflow See other posts from Stack Overflow or by Jimbo
Published on 2010-04-06T18:18:00Z Indexed on 2010/04/06 18:23 UTC
Read the original article Hit count: 536

Filed under:

Hi, I've got problems on getting django to work on apache 2.2 with mod_wsgi. Django is installed and mod_wsgi too. I can even see a 404 page when accessing the path and I can login to django admin. But if I want to install the tagging module I get the following error:

 Traceback (most recent call last):
   File "", line 49, in <module>
  version_tuple = __import__('tagging').VERSION
   File "/home/jim/django-tagging/tagging/", line 3, in <module>
  from tagging.managers import ModelTaggedItemManager, TagDescriptor
   File "/home/jim/django-tagging/tagging/", line 5, in <module>
  from django.contrib.contenttypes.models import ContentType
   File "/usr/lib/python2.5/site-packages/django/contrib/contenttypes/", line 1, in <module>
  from django.db import models
   File "/usr/lib/python2.5/site-packages/django/db/", line 10, in <module>
  if not settings.DATABASE_ENGINE:
   File "/usr/lib/python2.5/site-packages/django/utils/", line 269, in __getattr__
   File "/usr/lib/python2.5/site-packages/django/conf/", line 40, in _setup
  self._wrapped = Settings(settings_module)
   File "/usr/lib/python2.5/site-packages/django/conf/", line 75, in __init__
  raise ImportError, "Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)
 ImportError: Could not import settings 'mysite.settings' (Is it on sys.path? Does it have syntax errors?): No module named mysite.settings

My httpd.conf:

 Alias /media/ /home/jim/django/mysite/media/

 <Directory /home/jim/django/mysite/media>
  Order deny,allow
  Allow from all

 Alias /admin/media/ "/usr/lib/python2.5/site-packages/django/contrib/admin/media/"

 <Directory "/usr/lib/python2.5/site-packages/django/contrib/admin/media/">
  Order allow,deny
  Allow from all

 WSGIScriptAlias /dj /home/jim/django/mysite/apache/django.wsgi

 <Directory /home/jim/django/mysite/apache>
  Order deny,allow
  Allow from all

My django.wsgi:

import sys, os


os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

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

I try to get this to work since a few days and have read several blogs and answers here on so but nothing worked.

© Stack Overflow or respective owner

Related posts about django

Related posts about mod-wsgi