Adjustments for maintenance-mode options:

- Brings the state into the same directory as the runtime config file
This commit is contained in:
Oliver 2021-12-05 17:28:46 +11:00
parent 7ba01612d8
commit ae8166984f

View File

@ -86,6 +86,9 @@ if not os.path.exists(cfg_filename):
with open(cfg_filename, 'r') as cfg:
CONFIG = yaml.safe_load(cfg)
# We will place any config files in the same directory as the config file
config_dir = os.path.dirname(cfg_filename)
# Default action is to run the system in Debug mode
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = _is_true(get_setting(
@ -206,6 +209,16 @@ if MEDIA_ROOT is None:
print("ERROR: INVENTREE_MEDIA_ROOT directory is not defined")
sys.exit(1)
# Options for django-maintenance-mode : https://pypi.org/project/django-maintenance-mode/
MAINTENANCE_MODE_STATE_FILE_PATH = os.path.join(
config_dir,
'maintenance_mode_state.txt',
)
MAINTENANCE_MODE_IGNORE_ADMIN_SITE = True
MAINTENANCE_MODE_IGNORE_SUPERUSER = True
# List of allowed hosts (default = allow all)
ALLOWED_HOSTS = CONFIG.get('allowed_hosts', ['*'])