From 76ac6bc7fbd87ab783f5b333e291a417c6da6341 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Sat, 25 Nov 2023 10:44:57 +0100 Subject: [PATCH] Use tomllib instead of toml --- nummi/nummi/settings.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/nummi/nummi/settings.py b/nummi/nummi/settings.py index 346c749..1050bab 100644 --- a/nummi/nummi/settings.py +++ b/nummi/nummi/settings.py @@ -11,15 +11,14 @@ https://docs.djangoproject.com/en/4.0/ref/settings/ """ import os +import tomllib from pathlib import Path -import toml - CONFIG_PATH = os.environ.get("NUMMI_CONFIG", None) -if CONFIG_PATH is None: - CONFIG = dict() -else: - CONFIG = toml.load(CONFIG_PATH) +CONFIG = dict() +if CONFIG_PATH is not None: + with Path(CONFIG_PATH).open("rb") as CONFIG_FILE: + CONFIG = tomllib.load(CONFIG_FILE) # Build paths inside the project like this: BASE_DIR / 'subdir'. MEDIA_CONF = CONFIG.get("media", {})