From 93c11c7c4abc9b52ee896fc6a547138216bc7ae0 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Mon, 9 Feb 2015 22:36:17 -0400 Subject: [PATCH] Don't overwrite settings/local.py in subsequent initialsetup executions --- mayan/apps/main/management/commands/initialsetup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mayan/apps/main/management/commands/initialsetup.py b/mayan/apps/main/management/commands/initialsetup.py index bfe52f2a14..95812b797c 100644 --- a/mayan/apps/main/management/commands/initialsetup.py +++ b/mayan/apps/main/management/commands/initialsetup.py @@ -15,7 +15,12 @@ class Command(management.BaseCommand): return get_random_string(50, chars) def handle(self, *args, **options): - with open(os.path.join(settings.BASE_DIR, 'mayan', 'settings', 'local.py'), 'w+') as file_object: + path = os.path.join(settings.BASE_DIR, 'mayan', 'settings', 'local.py') + if os.path.exists(path): + print 'Existing file at: {0}. Backup, remove this file and try again.'.format(path) + exit(1) + + with open(path, 'w+') as file_object: file_object.write('\n'.join([ 'from __future__ import absolute_import', '',