[Fixed]-Django AllAuth Warning

0👍

Django regrouped all TEMPLATE_* vars into TEMPLATES var since Django 1.8+

https://docs.djangoproject.com/en/1.8/topics/templates/

This means you can move this part of the code in your TEMPLATE var:

"allauth.account.context_processors.account",
"allauth.socialaccount.context_processors.socialaccount",

And delete this:

TEMPLATE_CONTEXT_PROCESSORS = (
"django.core.context_processors.request",
"django.contrib.auth.context_processors.auth",
"allauth.account.context_processors.account",
"allauth.socialaccount.context_processors.socialaccount",
)

Final result:

TEMPLATES = [
    {
        # ...
        'OPTIONS': {
            # ...
            'context_processor': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
                'sekizai.context_processors.sekizai',
                "allauth.account.context_processors.account",
                "allauth.socialaccount.context_processors.socialaccount",
            ]
        }
    }
]

1👍

As the warning is suggested,you need to move TEMPLATE_CONTEXT_PROCESSORS settings inside TEMPLATES settings,Like this :

TEMPLATES = [
{
    'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'DIRS': [os.path.join(BASE_DIR, 'templates')]
    ,
    'APP_DIRS': True,
    'OPTIONS': {
        'debug': DEBUG,
        'context_processors': [
            'django.template.context_processors.debug',
            'django.template.context_processors.request',
            'django.contrib.auth.context_processors.auth',
            'django.contrib.messages.context_processors.messages',
            'sekizai.context_processors.sekizai',
            "allauth.account.context_processors.account",
            "allauth.socialaccount.context_processors.socialaccount",
        ],
    },
},
]

AUTHENTICATION_BACKENDS = (
# Needed to login by username in Django admin, regardless of `allauth`
'django.contrib.auth.backends.ModelBackend',

# `allauth` specific authentication methods, such as login by e-mail
'allauth.account.auth_backends.AuthenticationBackend',
)

So,all the TEMPLATE_CONTEXT_PROCESSORS will be inside TEMPLATES,with ‘context_processors’ settings,Thanks.

Leave a comment