Menu

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

open
nobody
None
2019-03-18
2015-05-29
Anonymous
No

Originally created by: troygrosfield

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

Related

Tickets: #578
Tickets: #588
Tickets: #612

Discussion

  • Anonymous

    Anonymous - 2015-07-13

    Originally posted by: javipalanca

    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)

     
  • Anonymous

    Anonymous - 2015-10-21

    Originally posted by: jrabbit

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

     

    Related

    Tickets: #549

  • Anonymous

    Anonymous - 2019-03-18

    Originally posted by: Blutude

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

     

Log in to post a comment.

MongoDB Logo MongoDB