Use tomllib instead of toml
This commit is contained in:
parent
3c1e4ac45d
commit
76ac6bc7fb
1 changed files with 5 additions and 6 deletions
|
@ -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()
|
if CONFIG_PATH is not None:
|
||||||
else:
|
with Path(CONFIG_PATH).open("rb") as CONFIG_FILE:
|
||||||
CONFIG = toml.load(CONFIG_PATH)
|
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", {})
|
||||||
|
|
Loading…
Reference in a new issue