mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Auto create config file in specified location if it does not exist
This commit is contained in:
parent
e787c853e5
commit
178715ce61
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user