django-pipeline
django-pipeline copied to clipboard
Use ManifestStaticFilesStorage instead of CachedStaticFilesStorage
Question : Would ManifestStaticFilesStorage be a suitable replacement when using cache busting url for this project ?
Reason : According to recent Django docs
Warning CachedStaticFilesStorage isn’t recommended – in almost all cases ManifestStaticFilesStorage is a better choice. There are several performance penalties when using CachedStaticFilesStorage since a cache miss requires hashing files at runtime. Remote file storage require several round-trips to hash a file on a cache miss, as several file accesses are required to ensure that the file hash is correct in the case of nested file paths.
Another good article : https://devblog.kogan.com/blog/a-hidden-gem-in-django-1-7-manifeststaticfilesstorage
RemovedInDjango31Warning: CachedStaticFilesStorage is deprecated in favor of ManifestStaticFilesStorage.
Hi souls!
I just came across this issue while investigating something slightly related.
@bitcity I would say the project already uses ManifestStaticFilesStorage
when possible:
(from pipeline.storage
)
from django.contrib.staticfiles.storage import (
ManifestStaticFilesStorage,
StaticFilesStorage,
)
from django.contrib.staticfiles.utils import matches_patterns
from django.core.files.base import File
_CACHED_STATIC_FILES_STORAGE_AVAILABLE = django_version() < "3.1"
if _CACHED_STATIC_FILES_STORAGE_AVAILABLE:
from django.contrib.staticfiles.storage import CachedStaticFilesStorage
So...I guess your questioned is already answered and the issue solved?
Assuming this can be closed...