Django TemplateSyntaxError - 'staticfiles' is not a registered tag library
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Music Box Puzzles
--
Chapters
00:00 Question
00:30 Accepted answer (Score 365)
01:01 Answer 2 (Score 20)
01:30 Answer 3 (Score 8)
01:47 Answer 4 (Score 3)
02:12 Thank you
--
Full question
https://stackoverflow.com/questions/5592...
Accepted answer links:
[deprecated in Django 2.1]: https://docs.djangoproject.com/en/2.2/re...
[removed in Django 3.0]: https://docs.djangoproject.com/en/dev/re...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #django #djangotemplates #django30
#avk47
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Music Box Puzzles
--
Chapters
00:00 Question
00:30 Accepted answer (Score 365)
01:01 Answer 2 (Score 20)
01:30 Answer 3 (Score 8)
01:47 Answer 4 (Score 3)
02:12 Thank you
--
Full question
https://stackoverflow.com/questions/5592...
Accepted answer links:
[deprecated in Django 2.1]: https://docs.djangoproject.com/en/2.2/re...
[removed in Django 3.0]: https://docs.djangoproject.com/en/dev/re...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #django #djangotemplates #django30
#avk47
ACCEPTED ANSWER
Score 381
If you have any of the following tags in your template:
{% load staticfiles %}
{% load static from staticfiles %}
{% load admin_static %}
Then replace it with:
{% load static %}
You have to make this change because {% load staticfiles %} and {% load admin_static %} were deprecated in Django 2.1, and removed in Django 3.0.
ANSWER 2
Score 20
- Try
{% load static %}instead of{% load staticfiles %} - If effect of CSS or any other files doesn't reflect in your template then also write following lines in the end of your
settings.pyfile
STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
VENV_PATH = os.path.dirname(BASE_DIR)
STATIC_ROOT = os.path.join(VENV_PATH, 'static_root')
ANSWER 3
Score 9
This worked for me using django 3.1.4.
{% load static %}
<link rel="stylesheet" href="{% static 'style.css' %}">
its working for me
ANSWER 4
Score 2
this worked with me replace {% load static from staticfiles %} with {% load static %}
where :
go to your virtual environment "venv" /lip/python3.X/site-packages/leaflet/templates/leaflet/admin/widget.html and all of the .HTML files in the directory