当我在本地启动服务器时,这就是我在终端中获得的信息:
Required context processor django_facebook.context_processors.facebook wasnt found
Required context processor django.core.context_processors.request wasnt found
/Users/iam-tony/.envs/party_project/lib/python3.4/importlib/_bootstrap.py:321: RemovedInDjango19Warning: The django.forms.util module has been renamed. Use django.forms.utils instead.
return f(*args, **kwds)
但这是我的设置,两个context_processors都在那里:
TEMPLATES = [
{
# See: https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-TEMPLATES-BACKEND
'BACKEND': 'django.template.backends.django.DjangoTemplates',
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs
'DIRS': [
str(APPS_DIR.path('templates')),
],
'OPTIONS': {
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
'debug': DEBUG,
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders
# https://docs.djangoproject.com/en/dev/ref/templates/api/#loader-types
'loaders': [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
],
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
# Your stuff: custom template context processors go here
#django_facebook context procesor:
'django_facebook.context_processors.facebook',
],
},
},
]
我正在使用cookiecutter和Django1.8。我已经在这几天了,但我似乎无法找到类似的帖子。
答案 0 :(得分:0)
如果你查看django-facebook code,它就会过时
# make sure the context processors are present
required = ['django_facebook.context_processors.facebook',
'django.core.context_processors.request']
context_processors = settings.TEMPLATE_CONTEXT_PROCESSORS
for context_processor in required:
if context_processor not in context_processors:
logger.warn(
'Required context processor %s wasnt found', context_processor)
它正在检查旧设置,setting.TEMPLATE_CONTEXT_PROCESSORS
用于Django< 1.8,而不是新的context_processors
选项。
项目GitHub存储库中有an issue。在它被修复之前,它只是一个警告,所以你可以放心地忽略它。