No module named 'django.contrib.staticfiles.templatetags'
I'll leave this here just in case other people end up in this question to fix django 3 function location change.
It seems like in django 3, static templatetag is moved among builtin template tags.
https://docs.djangoproject.com/en/3.0/ref/templates/builtins/#std:templatetag-static
https://github.com/django/django/blob/50cf183d219face91822c75fa0a15fe2fe3cb32d/django/templatetags/static.py#L162
So instead of importing it from here: from django.contrib.staticfiles.templatetags.staticfiles import static
, you need to import it from here: from django.templatetags.static import static
This is going to be pretty common for a while as everyone starts to move into Django 3 over the next few years.
In addition to the accepted answer, this is what I've been adding to support both Django 2 and Django 3 static
imports (esp. helpful with managing packages)
try:
# Django 2
from django.contrib.staticfiles.templatetags.staticfiles import static
except ModuleNotFoundError:
# Django 3
from django.templatetags.static import static