tschellenbach / Django-facebook

Facebook open graph api implementation using the Django web framework in python
http://www.mellowmorning.com/
Other
1.43k stars 544 forks source link

Django 1.8 warning "Required context processor django_facebook.context_processors.facebook wasnt found" #539

Open troygrosfield opened 9 years ago

troygrosfield commented 9 years ago

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:

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

javipalanca commented 9 years ago

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)

jrabbit commented 9 years ago

This seems to be resolved by #549 so master seems to work

Blutude commented 5 years ago

I can't use this package on Django=2.0.7 because of that error. Any idea how to fix this?