From f21e8413fb3258b3e6fc395a6fc95c64574ac7c2 Mon Sep 17 00:00:00 2001 From: j Date: Sat, 28 May 2016 11:06:43 +0200 Subject: [PATCH] use get_random_string --- pandora/settings.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pandora/settings.py b/pandora/settings.py index fd2e6b1c..cea889fd 100644 --- a/pandora/settings.py +++ b/pandora/settings.py @@ -248,8 +248,9 @@ except NameError: SECRET_KEY = open(SECRET_FILE).read().strip() except IOError: try: - from random import choice - SECRET_KEY = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)]) + from django.utils.crypto import get_random_string + chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)' + SECRET_KEY = get_random_string(50, chars) secret = file(SECRET_FILE, 'w') secret.write(SECRET_KEY) secret.close()