Skip to content
Snippets Groups Projects
Commit cef96c9d authored by robinwilliam.hundt's avatar robinwilliam.hundt
Browse files

Secret is now generated if it's empty

parent a2b43005
No related branches found
No related tags found
1 merge request!116Secret is now generated if it's empty
Pipeline #78135 passed
...@@ -19,7 +19,9 @@ DEBUG = False ...@@ -19,7 +19,9 @@ DEBUG = False
SECRET_FILE = 'secret' SECRET_FILE = 'secret'
try: try:
SECRET_KEY = open(SECRET_FILE).read().strip() SECRET_KEY = open(SECRET_FILE).read().strip()
except IOError: if len(SECRET_KEY) == 0:
raise Exception
except (IOError, Exception):
try: try:
SECRET_KEY = ''.join(secrets.choice(string.printable) SECRET_KEY = ''.join(secrets.choice(string.printable)
for i in range(50)) for i in range(50))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment