5

尝试在 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 版本: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",
)
4

1 回答 1

10

messages在这两行之间包含 , 后,您缺少逗号:

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

应该:

"django.contrib.messages.context_processors.messages",
"django.core.context_processors.request",
于 2013-06-27T20:33:49.820 回答