mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2025-11-04 14:49:58 +08:00
use secret key file
This commit is contained in:
parent
3bb3becfcf
commit
d5468803ba
@ -3,10 +3,10 @@
|
|||||||
APP=/app
|
APP=/app
|
||||||
DATA=/data
|
DATA=/data
|
||||||
|
|
||||||
mkdir -p $DATA/log $DATA/ssl $DATA/test_case $DATA/public/upload $DATA/public/avatar $DATA/public/website
|
mkdir -p $DATA/log $DATA/config $DATA/ssl $DATA/test_case $DATA/public/upload $DATA/public/avatar $DATA/public/website
|
||||||
|
|
||||||
if [ ! -f "$APP/oj/custom_settings.py" ]; then
|
if [ ! -f "$DATA/config/secret.key" ]; then
|
||||||
echo SECRET_KEY=\"$(cat /dev/urandom | head -1 | md5sum | head -c 32)\" >> $APP/oj/custom_settings.py
|
echo $(cat /dev/urandom | head -1 | md5sum | head -c 32) > "$DATA/config/secret.key"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "$DATA/public/avatar/default.png" ]; then
|
if [ ! -f "$DATA/public/avatar/default.png" ]; then
|
||||||
|
|||||||
@ -1,2 +0,0 @@
|
|||||||
# please set your own SECRET_KEY to a long random string
|
|
||||||
# SECRET_KEY = ""
|
|
||||||
@ -13,7 +13,6 @@ import os
|
|||||||
import raven
|
import raven
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from utils.shortcuts import get_env
|
from utils.shortcuts import get_env
|
||||||
from .custom_settings import *
|
|
||||||
|
|
||||||
production_env = get_env("OJ_ENV", "dev") == "production"
|
production_env = get_env("OJ_ENV", "dev") == "production"
|
||||||
if production_env:
|
if production_env:
|
||||||
@ -21,6 +20,9 @@ if production_env:
|
|||||||
else:
|
else:
|
||||||
from .dev_settings import *
|
from .dev_settings import *
|
||||||
|
|
||||||
|
with open(os.path.join(DATA_DIR, "config", "secret.key"), "r") as f:
|
||||||
|
SECRET_KEY = f.read()
|
||||||
|
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
# Applications
|
# Applications
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user