use get_random_string
This commit is contained in:
parent
7fdaf6d1ce
commit
f21e8413fb
1 changed files with 3 additions and 2 deletions
|
@ -248,8 +248,9 @@ except NameError:
|
||||||
SECRET_KEY = open(SECRET_FILE).read().strip()
|
SECRET_KEY = open(SECRET_FILE).read().strip()
|
||||||
except IOError:
|
except IOError:
|
||||||
try:
|
try:
|
||||||
from random import choice
|
from django.utils.crypto import get_random_string
|
||||||
SECRET_KEY = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)])
|
chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
|
||||||
|
SECRET_KEY = get_random_string(50, chars)
|
||||||
secret = file(SECRET_FILE, 'w')
|
secret = file(SECRET_FILE, 'w')
|
||||||
secret.write(SECRET_KEY)
|
secret.write(SECRET_KEY)
|
||||||
secret.close()
|
secret.close()
|
||||||
|
|
Loading…
Reference in a new issue