The django.core.context_processors module does not define an auth request handler

I have a Django live website, I want to do some sort of maintenance, but when I downloaded it and tried to open it from my local machine and my debug mode is correct I encountered this error:

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

I am using Python 2.5

I would be grateful for any help.

+47
django
Sep 19 '11 at 11:26
source share
2 answers

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

The context context handler has been migrated from django.core.context_processors.auth to django.contrib.auth.context_processors.auth . This step started in Django 1.2, and django.core.context_processors.auth was completely removed in Django 1.4.

I recommend that you run the same version of Django in your dev and production environments to prevent such errors.

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

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

When migrating release notes ( 1.2 , 1.3 , 1.4 ) are useful for detecting such changes.

+94
Sep 19 '11 at 11:47
source share

First check out the version of Django:

go into your application and run

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

In Django> 1.4, the previously deleted deprecated DATABASE_ENGINE setting is removed. (This deviation / deletion of the tic / toc-cycle type is typical of a Django project.)

I use the following code to fix obsolete scripts, which for some reason should be 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.

+1
Jul 18 '13 at 17:48
source share



All Articles