0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-30 01:46:24 +01:00

Use django.core.files.storage.storages in favour of get_storage_class()

This commit is contained in:
Sage Abdullah 2023-09-20 16:06:08 +01:00 committed by Matt Westcott
parent 5931a07b25
commit ab7ba231ee

View File

@ -2,7 +2,6 @@ import hashlib
from django.conf import settings
from django.contrib.staticfiles.storage import HashedFilesMixin
from django.core.files.storage import get_storage_class
from django.templatetags.static import static
from wagtail import __version__
@ -23,7 +22,17 @@ except AttributeError:
use_version_strings = True
else:
# see if we're using a storage backend using hashed filenames
storage = get_storage_class(settings.STATICFILES_STORAGE)
try:
from django.conf import STATICFILES_STORAGE_ALIAS
from django.core.files.storage import storages
storage = storages[STATICFILES_STORAGE_ALIAS].__class__
except ImportError:
# DJANGO_VERSION < 4.2
from django.core.files.storage import get_storage_class
storage = get_storage_class(settings.STATICFILES_STORAGE)
use_version_strings = not issubclass(storage, HashedFilesMixin)