From 1aaafc01e29d5a079989f02fed59f4f197759fc9 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Thu, 29 Dec 2022 18:14:55 +0100 Subject: [PATCH] Use toml python package to support python3.10 --- PKGBUILD | 1 + nummi/nummi/settings.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index d4868df..ace6797 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -9,6 +9,7 @@ depends=( "gunicorn" "python-django" "python-matplotlib" + "python-toml" ) makedepends=("git") optdepends=("postgresql: database") diff --git a/nummi/nummi/settings.py b/nummi/nummi/settings.py index c12bc8a..5181b36 100644 --- a/nummi/nummi/settings.py +++ b/nummi/nummi/settings.py @@ -10,16 +10,16 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/4.0/ref/settings/ """ -import tomllib import os from pathlib import Path +import toml + CONFIG_PATH = os.environ.get("NUMMI_CONFIG", None) if CONFIG_PATH is None: CONFIG = dict() else: - with open(CONFIG_PATH, "rb") as CONFIG_FILE: - CONFIG = tomllib.load(CONFIG_FILE) + CONFIG = toml.load(CONFIG_PATH) # Build paths inside the project like this: BASE_DIR / 'subdir'. MEDIA_CONF = CONFIG.get("media", {})