# Inspired from https://whalesalad.com/blog/doing-python-configuration-right import os import importlib # Determine the environment we want to load, default is development.py PYROS_ENV = os.environ.get("PYROS_ENV", "config_dev") PYROS_DEBUG = os.environ.get("PYROS_DEBUG", '0') == '1' module = importlib.import_module( #f".environments.{ENV}", package="service.config" #f".{PYROS_ENV}", package="config" f".{PYROS_ENV}", package="config.old_config" ) # update globals of this module (i.e. settings) with imported. globals().update(vars(module)) def is_dev_env(): return PYROS_ENV == "config_dev" def is_test_env(): return PYROS_ENV == "config_test" def is_prod_env(): return PYROS_ENV == "config_prod" def is_debug(): return PYROS_DEBUG