Use tomllib instead of toml

This commit is contained in:
Edgar P. Burkhart 2023-11-25 10:44:57 +01:00
parent 3c1e4ac45d
commit 76ac6bc7fb
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227

View file

@ -11,15 +11,14 @@ https://docs.djangoproject.com/en/4.0/ref/settings/
""" """
import os import os
import tomllib
from pathlib import Path from pathlib import Path
import toml
CONFIG_PATH = os.environ.get("NUMMI_CONFIG", None) CONFIG_PATH = os.environ.get("NUMMI_CONFIG", None)
if CONFIG_PATH is None:
CONFIG = dict() CONFIG = dict()
else: if CONFIG_PATH is not None:
CONFIG = toml.load(CONFIG_PATH) with Path(CONFIG_PATH).open("rb") as CONFIG_FILE:
CONFIG = tomllib.load(CONFIG_FILE)
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
MEDIA_CONF = CONFIG.get("media", {}) MEDIA_CONF = CONFIG.get("media", {})