Django-facebook
Django-facebook copied to clipboard
Django 1.8 warning "Required context processor django_facebook.context_processors.facebook wasnt found"
Receiving the following warning which shouldn't be there in django 1.8:
Required context processor django_facebook.context_processors.facebook wasnt found
The TEMPLATE_CONTEXT_PROCESSORS
setting is deprecated starting in django 1.8:
- https://docs.djangoproject.com/en/1.8/ref/settings/#template-context-processors
It was replaced in favor of a TEMPLATES setting where the dict needs to have context_processors defined as an options key:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(SITE_ROOT, 'templates')],
'OPTIONS': {
'context_processors': [
'django.core.context_processors.request',
'django.core.context_processors.media',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django_facebook.context_processors.facebook',
]
},
},
]
This line of code [1] is what needs to change:
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)
[1] https://github.com/tschellenbach/Django-facebook/blob/d31eb10aaa3a92fe1f5c60cc7461963f90929c09/django_facebook/models.py#L57
For me worked to comment lines 39-41 in views.py:
# validation to ensure the context processor is enabled
if not context.get('FACEBOOK_APP_ID'):
message = 'Please specify a Facebook app id and ensure the context processor is enabled'
raise ValueError(message)
This seems to be resolved by #549 so master seems to work
I can't use this package on Django=2.0.7 because of that error. Any idea how to fix this?