9👍
django.contrib.staticfiles.templatetags
was removed in version 3
The staticfiles and admin_static template tag libraries are removed.
The django-summernote
package has not been updated since January and does not support Django 3
39👍
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
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
- How does django convert string to modules?
- Celery workers unable to connect to redis on docker instances
12👍
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
- Celery workers unable to connect to redis on docker instances
- Pydev not recognizing python installation with django
- Django test client does not log in
- How to raise a error inside form_valid method of a CreateView
- Django/python: 'function' object has no attribute 'as_view'
- Change list link to foreign key change page
- Can't debug Django unit tests within Visual Studio Code