From c9e2e74a3932afc90b499b34e76cd5e31c8a945c Mon Sep 17 00:00:00 2001 From: kimihito Date: Wed, 22 May 2024 15:45:37 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=9C=20Use=20STORAGES["staticfiles"]=20?= =?UTF-8?q?instead=20of=20STATICFILES=5FSTORAGE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/settings.py-tpl | 6 +++++- conftest.py-tpl | 9 ++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/config/settings.py-tpl b/config/settings.py-tpl index d71b0c7..d4e6521 100644 --- a/config/settings.py-tpl +++ b/config/settings.py-tpl @@ -121,7 +121,11 @@ USE_TZ = True STATIC_ROOT = str(BASE_DIR.joinpath("static")) STATIC_URL = "/static/" STATICFILES_DIRS = (str(BASE_DIR.joinpath("frontend")),) -# STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" +# STORAGES = { +# "staticfiles": { +# "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage" +# } +# } MEDIA_URL = "/media/" MEDIA_ROOT = str(BASE_DIR.joinpath("media")) diff --git a/conftest.py-tpl b/conftest.py-tpl index 9dbf029..683111d 100644 --- a/conftest.py-tpl +++ b/conftest.py-tpl @@ -23,8 +23,11 @@ def use_test_settings(settings): # User a faster password hasher settings.PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"] - settings.STATICFILES_STORAGE = ( - "django.contrib.staticfiles.storage.StaticFilesStorage" - ) + settings.STORAGES = { + "staticfiles": { + "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage" + } + } + settings.WHITENOISE_AUTOREFRESH = True