From b117dc8227a2df19bacf08d9dbaf74d5a044ccf5 Mon Sep 17 00:00:00 2001 From: d9pouces Date: Sun, 19 Jan 2025 15:05:17 +0100 Subject: [PATCH] fix: fix the test settings for Django 5.1+ and for Django 5.0- --- tests/settings.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/tests/settings.py b/tests/settings.py index 527412dd..e1334076 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -2,6 +2,8 @@ import os import shutil +from django.utils import version + def local_path(path): return os.path.join(os.path.dirname(__file__), path) @@ -42,15 +44,19 @@ def local_path(path): MEDIA_ROOT = local_path("media") -STATICFILES_STORAGE = "pipeline.storage.PipelineStorage" -STORAGES = { - "default": { - "BACKEND": "pipeline.storage.PipelineStorage", - }, - "staticfiles": { - "BACKEND": "pipeline.storage.PipelineStorage", - }, -} +django_version = version.get_complete_version() +if django_version >= (4, 2): + + STORAGES = { + "default": { + "BACKEND": "pipeline.storage.PipelineStorage", + }, + "staticfiles": { + "BACKEND": "pipeline.storage.PipelineStorage", + }, + } +else: + STATICFILES_STORAGE = "pipeline.storage.PipelineStorage" STATIC_ROOT = local_path("static/") STATIC_URL = "/static/" STATICFILES_DIRS = (("pipeline", local_path("assets/")),)