1

settings: $STATE_DIRECTORY is not useful

Packages on "real servers" will set it in package params.
This commit is contained in:
Motiejus Jakštys 2024-01-15 10:24:49 +02:00
parent 2301cb2191
commit 95c67fc575

View File

@ -1,5 +1,5 @@
from pathlib import Path from pathlib import Path
from os import environ, path from os import environ
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent BASE_DIR = Path(__file__).resolve().parent.parent
@ -10,9 +10,6 @@ _STATIC_ROOT = environ.get('E11SYNC_STATIC_ROOT', '/tmp/e11sync-static')
_GEOIP_PATH = environ.get('GEOIP_PATH') _GEOIP_PATH = environ.get('GEOIP_PATH')
if db := environ.get('E11SYNC_DATABASE_PATH'): if db := environ.get('E11SYNC_DATABASE_PATH'):
_DATABASE_PATH = db _DATABASE_PATH = db
else:
if statedir := environ.get('STATE_DIRECTORY'):
_DATABASE_PATH = path.join(statedir, 'db.sqlite3')
else: else:
_DATABASE_PATH = BASE_DIR / 'db.sqlite3' _DATABASE_PATH = BASE_DIR / 'db.sqlite3'