mirror of
https://github.com/etesync/server
synced 2024-11-18 06:48:08 +00:00
12 lines
335 B
Python
12 lines
335 B
Python
from django.core.management import utils
|
|
|
|
def get_secret_from_file(path):
|
|
try:
|
|
with open(path, "r") as f:
|
|
return f.read().strip()
|
|
except EnvironmentError:
|
|
with open(path, "w") as f:
|
|
secret_key = utils.get_random_secret_key()
|
|
f.write(secret_key)
|
|
return secret_key
|