|
|
@ -13,6 +13,8 @@
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
|
|
from django.core.management import utils
|
|
|
|
from django.core.management import utils
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
import stat
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_secret_from_file(path):
|
|
|
|
def get_secret_from_file(path):
|
|
|
@ -21,6 +23,7 @@ def get_secret_from_file(path):
|
|
|
|
return f.read().strip()
|
|
|
|
return f.read().strip()
|
|
|
|
except EnvironmentError:
|
|
|
|
except EnvironmentError:
|
|
|
|
with open(path, "w") as f:
|
|
|
|
with open(path, "w") as f:
|
|
|
|
|
|
|
|
os.chmod(path, stat.S_IRUSR | stat.S_IWUSR)
|
|
|
|
secret_key = utils.get_random_secret_key()
|
|
|
|
secret_key = utils.get_random_secret_key()
|
|
|
|
f.write(secret_key)
|
|
|
|
f.write(secret_key)
|
|
|
|
return secret_key
|
|
|
|
return secret_key
|
|
|
|