Skip to content

Commit

Permalink
check if keys directory exists before making secret_key (#700)
Browse files Browse the repository at this point in the history
  • Loading branch information
benhoff authored and nmanovic committed Sep 9, 2019
1 parent 8f25bac commit eaede02
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cvat/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@
from keys.secret_key import SECRET_KEY
except ImportError:
from django.utils.crypto import get_random_string
with open(os.path.join(BASE_DIR, 'keys', 'secret_key.py'), 'w') as f:
keys_dir = os.path.join(BASE_DIR, 'keys')
if not os.path.isdir(keys_dir):
os.mkdir(keys_dir)
with open(os.path.join(keys_dir, 'secret_key.py'), 'w') as f:
chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
f.write("SECRET_KEY = '{}'\n".format(get_random_string(50, chars)))
from keys.secret_key import SECRET_KEY
Expand Down

0 comments on commit eaede02

Please sign in to comment.