storage: Use Django 4.0 manifest_storage option.

https://code.djangoproject.com/ticket/27590
https://docs.djangoproject.com/en/4.0/ref/contrib/staticfiles/#manifeststaticfilesstorage

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2022-07-26 15:41:04 -07:00 committed by Tim Abbott
parent 6062bad761
commit b17affc3da

View File

@ -6,6 +6,7 @@ from typing import Optional
from django.conf import settings
from django.contrib.staticfiles.storage import ManifestStaticFilesStorage
from django.core.files.storage import FileSystemStorage
if settings.DEBUG:
from django.contrib.staticfiles.finders import find
@ -56,9 +57,5 @@ class ZulipStorage(IgnoreBundlesManifestStaticFilesStorage):
# so, we can use a different copy of staticfiles.json for each
# deployment, which ensures that we always use the correct static
# assets for each deployment.
manifest_name = os.path.join(settings.DEPLOY_ROOT, "staticfiles.json")
def path(self, name: str) -> str:
if name == self.manifest_name:
return name
return super().path(name)
def __init__(self) -> None:
return super().__init__(manifest_storage=FileSystemStorage(location=settings.DEPLOY_ROOT))