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', '',