Don't overwrite settings/local.py in subsequent initialsetup executions

This commit is contained in:
Roberto Rosario
2015-02-09 22:36:17 -04:00
parent cc7b566ff2
commit 93c11c7c4a

View File

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