From ea2b7c1be4095853e17473cc5f925a6e34d8697f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Sun, 28 Jan 2024 23:36:00 +0200 Subject: [PATCH] fix plain tests --- app/e11sync/settings.py | 18 +++++++++++++----- flake.nix | 1 + 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/e11sync/settings.py b/app/e11sync/settings.py index 8d0a3ea..bbed060 100644 --- a/app/e11sync/settings.py +++ b/app/e11sync/settings.py @@ -7,6 +7,17 @@ BASE_DIR = Path(__file__).resolve().parent.parent _DEBUG = bool(environ.get('E11SYNC_DEBUG', False)) _STATIC_ROOT = environ.get('E11SYNC_STATIC_ROOT', BASE_DIR / '_static') _GEOIP_PATH = environ.get('GEOIP_PATH') + +_STATICFILES_STORAGE = environ.get('E11SYNC_STATICFILES', 'manifest') +if _STATICFILES_STORAGE == 'manifest': + _prefix = 'lib.staticfiles.' + _STATICFILES_STORAGE_BACKEND = _prefix + 'ManifestStaticFilesStorageSha256' +elif _STATICFILES_STORAGE == 'simple': + _prefix = 'django.contrib.staticfiles.storage.' + _STATICFILES_STORAGE_BACKEND = _prefix + 'StaticFilesStorage' +else: + raise Exception("E11SYNC_STATICFILES neither 'manifest' nor 'simple'") + if db := environ.get('E11SYNC_DATABASE_PATH'): _DATABASE_PATH = db else: @@ -27,6 +38,7 @@ if not environ.get("E11SYNC_DEBUG_PRINTED"): print("STATIC_ROOT={}".format(_STATIC_ROOT)) print("GEOIP_PATH={}".format(_GEOIP_PATH)) print("DATABASE_PATH={}".format(_DATABASE_PATH)) + print("STATICFILES_STORAGE_BACKEND=" + _STATICFILES_STORAGE_BACKEND) environ["E11SYNC_DEBUG_PRINTED"] = "1" ####################################### @@ -114,11 +126,7 @@ STATICFILES_FINDERS = [ "django.contrib.staticfiles.finders.AppDirectoriesFinder", ] -STORAGES = { - "staticfiles": { - "BACKEND": 'lib.staticfiles.ManifestStaticFilesStorageSha256' - }, -} +STORAGES = {"staticfiles": {"BACKEND": _STATICFILES_STORAGE_BACKEND}} STATIC_ROOT = _STATIC_ROOT diff --git a/flake.nix b/flake.nix index 099d588..e8da889 100644 --- a/flake.nix +++ b/flake.nix @@ -115,6 +115,7 @@ ]; GEOIP_PATH = "${pkgs.geoip-mmdb}"; E11SYNC_DEBUG = "1"; + E11SYNC_STATICFILES = "simple"; LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive"; inherit (self.checks.${system}.pre-commit-check) shellHook; };