47

I have a Django live website , i want to do some kind of maintenance on it but when I downloaded it and tried to open it from my local machine and my debug mode is true I faced this error:

ImproperlyConfigured at /

Module "django.core.context_processors" does not define a "auth" callable request processor

I'm using Python 2.5

I would be grateful for any help.

mena samy
  • 475
  • 1
  • 4
  • 5

2 Answers2

96

It looks like you have upgraded to Django 1.4 or later.

The auth context processor has been moved from django.core.context_processors.auth to django.contrib.auth.context_processors.auth. The move started in Django 1.2, and django.core.context_processors.auth was completely removed in Django 1.4.

I recommend you run the same version of Django on your dev and production environments to prevent errors like this.

When you upgrade to Django 1.4, you need to make the following change to TEMPLATE_CONTEXT_PROCESSORS in your settings file:

# old
TEMPLATE_CONTEXT_PROCESSORS = ("django.core.context_processors.auth",
                               ...
)
# new
TEMPLATE_CONTEXT_PROCESSORS = ("django.contrib.auth.context_processors.auth",
                               ...
)

When migrating, the release notes (1.2, 1.3, 1.4) are useful for catching changes like this.

Alasdair
  • 298,606
  • 55
  • 578
  • 516
  • Thank you it works now ! but i have another problem that all my css files and js files paths are wrong Ex: the MEDIA_URL is empty even i set in settings.py MEDIA_URL = '/static/website/' what is the problem with it ?? Thanks, Mena Samy – mena samy Sep 19 '11 at 13:53
  • Do you have `"django.core.context_processors.media"` in your `TEMPLATE_CONTEXT_PROCESSORS`? – Alasdair Sep 19 '11 at 14:05
  • yes i have it , MEDIA_URL append the file path after the localhost and give me missing files http://127.0.0.1:8000/static/website/css/reset.css" – mena samy Sep 19 '11 at 14:07
  • If the media files are not being served locally, you can get the django server to serve media files in development. See https://docs.djangoproject.com/en/dev/howto/static-files/#serving-other-directories – Alasdair Sep 19 '11 at 15:10
1

First check your Django version:

go into your app and run

$./manage.py shell
import django
django.get_version()

In Django >1.4 the previously deprecated-marked setting DATABASE_ENGINE is removed. (This deprecation/removal like tic/toc-cycle is typical for the Django project. )

I am using the following code to fix legacy scripts, which for some reasons have to be kept obsolete...

    if not ((hasattr(settings, 'DATABASE_ENGINE') and (settings.DATABASES['default']['ENGINE'] or 'ENGINE' in [x for y in settings.DATABASES.itervalues() for x in y]))):
      try:
        setattr(settings, 'DATABASE_ENGINE', settings.DATABASES['default']['ENGINE'])
      except:
        raise Exception('No default ENGINE set in settings.DATABASES!')

Hope this helps.

Lorenz Lo Sauer
  • 23,698
  • 16
  • 85
  • 87