From dcc4a5723eaac75f81ca160b4041939f24a41873 Mon Sep 17 00:00:00 2001 From: Karthik Balakrishnan Date: Mon, 8 May 2023 10:38:33 +0530 Subject: [PATCH] Migrate to new staticfiles storage setting (#570) --- takahe/settings.py | 6 +++++- tests/conftest.py | 10 +++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/takahe/settings.py b/takahe/settings.py index ff50e18..3aed739 100644 --- a/takahe/settings.py +++ b/takahe/settings.py @@ -303,7 +303,11 @@ STATICFILES_FINDERS = [ STATICFILES_DIRS = [BASE_DIR / "static"] -STATICFILES_STORAGE = "django.contrib.staticfiles.storage.ManifestStaticFilesStorage" +STORAGES = { + "staticfiles": { + "BACKEND": "django.contrib.staticfiles.storage.ManifestStaticFilesStorage" + }, +} SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies" diff --git a/tests/conftest.py b/tests/conftest.py index e1e25a2..d96c79e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -58,9 +58,13 @@ kwIDAQAB @pytest.fixture(autouse=True) def _test_settings(settings): - settings.STATICFILES_STORAGE = ( - "django.contrib.staticfiles.storage.StaticFilesStorage" - ) + # We use `StaticFilesStorage` instead of `ManifestStaticFilesStorage` in tests + # since want stable filenames (`css/styles.css`) instead of hashed (`css/styles.55e7cbb9ba48.css`) + settings.STORAGES = { + "staticfiles": { + "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage" + }, + } settings.SETUP.MAIN_DOMAIN = "example.com" settings.MAIN_DOMAIN = "example.com"