mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Renamed key.py to keygen.py
This commit is contained in:
parent
8d0df6654c
commit
0cec12085d
@ -1,4 +1,8 @@
|
||||
# Generate a SECRET_KEY file
|
||||
"""
|
||||
Module keygen
|
||||
=============
|
||||
This module generates a Django SECRET_KEY file to be used by manage.py
|
||||
"""
|
||||
|
||||
import random
|
||||
import string
|
||||
@ -10,9 +14,16 @@ KEY_FN = 'secret_key.txt'
|
||||
KEY_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
|
||||
def generate_key():
|
||||
def generate_key(length=50):
|
||||
"""
|
||||
Generate a random string
|
||||
|
||||
:param length: Number of characters in returned string (default=50)
|
||||
:returns: Randomized secret key string
|
||||
"""
|
||||
|
||||
options = string.digits + string.ascii_letters + string.punctuation
|
||||
key = ''.join([random.choice(options) for i in range(50)])
|
||||
key = ''.join([random.choice(options) for i in range(length)])
|
||||
return key
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user