revert change on USER_SETTINGS_FILE, fixing dev shell

This commit is contained in:
Kiara Grouwstra 2025-03-19 10:22:52 +01:00
parent afbbcbc22d
commit e3b816d85e
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU

View file

@ -176,14 +176,15 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
# TODO(@fricklerhandwerk): # TODO(@fricklerhandwerk):
# we may want to do this with a flat environment instead, and get all values from `os.environ.get()`. # we may want to do this with a flat environment instead, and get all values from `os.environ.get()`.
# this would make it more obvious which moving parts there are, if that environment is specified for development/staging/production in a visible place. # this would make it more obvious which moving parts there are, if that environment is specified for development/staging/production in a visible place.
user_settings_file = env["USER_SETTINGS_FILE"] user_settings_file = env.get("USER_SETTINGS_FILE", None)
spec = importlib.util.spec_from_file_location("user_settings", user_settings_file) if user_settings_file is not None:
if spec is None or spec.loader is None: spec = importlib.util.spec_from_file_location("user_settings", user_settings_file)
if spec is None or spec.loader is None:
raise RuntimeError("User settings specification failed!") raise RuntimeError("User settings specification failed!")
module = importlib.util.module_from_spec(spec) module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module) spec.loader.exec_module(module)
sys.modules["user_settings"] = module sys.modules["user_settings"] = module
from user_settings import * # noqa: F403 # pyright: ignore [reportMissingImports] from user_settings import * # noqa: F403 # pyright: ignore [reportMissingImports]
# non-Django application settings # non-Django application settings