17 lines
524 B
Python
17 lines
524 B
Python
import random
|
|
|
|
|
|
def get_random_string(length=12,
|
|
allowed_chars='abcdefghijklmnopqrstuvwxyz'
|
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'):
|
|
return ''.join(random.choice(allowed_chars) for i in range(length))
|
|
|
|
|
|
def get_random_secret_key():
|
|
"""
|
|
Return a 50 character random string usable as a SECRET_KEY setting value.
|
|
"""
|
|
chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
|
|
return get_random_string(50, chars)
|
|
|
|
print(get_random_secret_key()) |