Django cannot find static files when using django-allauth

When I use allauth, everything works fine, except that Django can no longer find static files. Without allauth, all static files are displayed. allauth settings need to be added

TEMPLATE_CONTEXT_PROCESSORS = ( "allauth.context_processors.allauth", "allauth.account.context_processors.account" ) 

I did not have TEMPLATE_CONTEXT_PROCESSORS in my settings file before. Is there something I'm missing? How do I solve this problem. When I see the DEBUG console, I see that it is trying to extract the css file as

 "GET /accounts/login/css/contact.css" 

then how should he do

 "GET /static/css/contact.css" 
+4
source share
1 answer

There is a default value for TEMPLATE_CONTEXT_PROCESSORS, and you override this. So, now by default are absent. And one of them is "django.core.context_processors.static", so Django cannot find your static files.

See https://docs.djangoproject.com/en/1.3/ref/settings/#template-context-processors for the default list. You need the following:

  TEMPLATE_CONTEXT_PROCESSORS = ( "django.contrib.auth.context_processors.auth", "django.core.context_processors.debug", "django.core.context_processors.i18n", "django.core.context_processors.media", "django.core.context_processors.static", "django.contrib.messages.context_processors.messages", "allauth.context_processors.allauth", "allauth.account.context_processors.account", ) 
+7
source

Source: https://habr.com/ru/post/1385526/


All Articles