瀏覽代碼

Use ManifestStaticFilesStorage as default static files storage

Sage Abdullah 2 月之前
父節點
當前提交
b3f85a68d9
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      bakerydemo/settings/base.py

+ 7 - 1
bakerydemo/settings/base.py

@@ -182,12 +182,18 @@ STATIC_URL = "/static/"
 MEDIA_ROOT = os.path.join(PROJECT_DIR, "media")
 MEDIA_URL = "/media/"
 
+# Default storage settings, with the staticfiles storage updated.
+# See https://docs.djangoproject.com/en/stable/ref/settings/#std-setting-STORAGES
 STORAGES = {
     "default": {
         "BACKEND": "django.core.files.storage.FileSystemStorage",
     },
+    # ManifestStaticFilesStorage is recommended in production, to prevent
+    # outdated JavaScript / CSS assets being served from cache
+    # (e.g. after a Wagtail upgrade).
+    # See https://docs.djangoproject.com/en/stable/ref/contrib/staticfiles/#manifeststaticfilesstorage
     "staticfiles": {
-        "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
+        "BACKEND": "django.contrib.staticfiles.storage.ManifestStaticFilesStorage",
     },
 }