From efe8fcbc5ab7f83e6eec9ce8a532ba8acc4e4fa2 Mon Sep 17 00:00:00 2001 From: Diederik van der Boor Date: Mon, 26 Aug 2024 13:54:51 +0200 Subject: [PATCH] Update pre-commit-config setting for django-upgrade, changes STORAGES setting --- .pre-commit-config.yaml | 2 +- src/dso_api/settings.py | 9 ++++++++- src/tests/settings.py | 7 ++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a5f798c6f..b64bbb59c 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: hooks: - id: django-upgrade args: - - --target-version=3.2 + - --target-version=4.2 - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.5.5 hooks: diff --git a/src/dso_api/settings.py b/src/dso_api/settings.py index dbf52b1da..8dedc874a 100644 --- a/src/dso_api/settings.py +++ b/src/dso_api/settings.py @@ -405,7 +405,14 @@ VIEW_NAME_FUNCTION="rest_framework_dso.views.get_view_name", ) -STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" +STORAGES = { + "default": { + "BACKEND": "django.core.files.storage.FileSystemStorage", + }, + "staticfiles": { + "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage", + }, +} SPECTACULAR_SETTINGS = { "TITLE": "DSO-API", diff --git a/src/tests/settings.py b/src/tests/settings.py index b50c9ab9e..77d43c289 100644 --- a/src/tests/settings.py +++ b/src/tests/settings.py @@ -47,7 +47,12 @@ # Prevent tests to crash because of missing staticfiles manifests WHITENOISE_MANIFEST_STRICT = False -STATICFILES_STORAGE = "django.contrib.staticfiles.storage.StaticFilesStorage" +STORAGES = { + **STORAGES, + "staticfiles": { + "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage", + }, +} # During testing we want to see if there is unwanted deferred access SEAL_WARN_ONLY = False