1
Fork 0

fix plain tests

This commit is contained in:
Motiejus Jakštys 2024-01-28 23:36:00 +02:00
parent c768ef7a44
commit ea2b7c1be4
2 changed files with 14 additions and 5 deletions

View File

@ -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

View File

@ -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;
};