导入请求处理器模块Django时出错

时间:2013-06-27 20:32:52

标签: python django

尝试在Django settings.py中配置TEMPLATE_CONTEXT PROCESSORS时出现以下错误:

        Exception Value: Error importing request processor module  
        django.contrib.messages.context_processors.messagesdjango.core.context_processors: 
        "No module named 'django.contrib.messages.context_processors.messagesdjango'; 
        django.contrib.messages.context_processors is not a package"

我的TEMPLATE_CONTEXT_PROCESSORS如下:(Django Version:1.5.1)

TEMPLATE_CONTEXT_PROCESSORS = (
  "django.contrib.auth.context_processors.auth",
  "django.core.context_processors.debug",
  "django.core.context_processors.i18n",
  "django.core.context_processors.media",
  "django.core.context_processors.static",
  "django.core.context_processors.tz",
  "django.contrib.messages.context_processors.messages"
  "django.core.context_processors.request",
)

1 个答案:

答案 0 :(得分:10)

在这两行之间包含messages后,您错过了一个逗号:

"django.contrib.messages.context_processors.messages"
"django.core.context_processors.request",

应该是:

"django.contrib.messages.context_processors.messages",
"django.core.context_processors.request",