模块“django.core.context_processors”不定义“认证”可请求请求处理器 [英] Module "django.core.context_processors" does not define a "auth" callable request processor

查看:117
本文介绍了模块“django.core.context_processors”不定义“认证”可请求请求处理器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Django实时网站,我想做一些维护,但是当我下载它,并尝试从本地机器打开它,我的调试模式是真的
我遇到这个错误: / p>

 在/ 

中不正确地配置模块django.core.context_processors没有定义auth可调用请求处理器

我使用的是Python 2.5



我将不胜感激。

解决方案

看起来你已经升级到Django 1.4或更高版本。 >

auth上下文处理器已从 django.core.context_processors.auth 移动到 django.contrib .auth.context_processors.auth 。这个动作在Django 1.2中开始,在Django 1.4中完全删除了 django.core.context_processors.auth



我建议您在开发和生产环境中运行相同版本的Django,以防止这样的错误。



当您升级到Django 1.4时,您需要进行以下更改 TEMPLATE_CONTEXT_PROCESSORS 在您的设置文件中:

 #old 
TEMPLATE_CONTEXT_PROCESSORS =(django.core.context_processors auth,
...

#new
TEMPLATE_CONTEXT_PROCESSORS =(django.contrib.auth.context_processors.auth,
...

迁移时,发行说明( 1.2 1.3 1.4 )对于捕获这样的更改很有用。


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.

解决方案

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.

这篇关于模块“django.core.context_processors”不定义“认证”可请求请求处理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆