From 178715ce6113b96aee9ec590498736fceee8485e Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 10 Apr 2021 20:57:56 +1000 Subject: [PATCH] Auto create config file in specified location if it does not exist --- InvenTree/InvenTree/settings.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index a8a2060451..9a6a4d59ae 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -64,9 +64,6 @@ if cfg_filename: cfg_filename = cfg_filename.strip() cfg_filename = os.path.abspath(cfg_filename) - if not os.path.exists(cfg_filename): - print(f"InvenTree configuration file '{cfg_filename}' does not exist!") - sys.exit(1) else: # Config file is *not* specified - use the default cfg_filename = os.path.join(BASE_DIR, 'config.yaml') @@ -76,6 +73,7 @@ if not os.path.exists(cfg_filename): cfg_template = os.path.join(BASE_DIR, "config_template.yaml") shutil.copyfile(cfg_template, cfg_filename) + print(f"Created config file {cfg_filename}") with open(cfg_filename, 'r') as cfg: CONFIG = yaml.safe_load(cfg)