OnlineJudge/deploy/run.sh

23 lines
433 B
Bash
Raw Normal View History

2017-10-23 02:47:26 +00:00
#!/bin/bash
BASE=/app
if [ ! -f "$BASE/custom_settings.py" ]; then
echo SECRET_KEY=\"$(cat /dev/urandom | head -1 | md5sum | head -c 32)\" >> /app/oj/custom_settings.py
fi
if [ ! -d "$BASE/log" ]; then
mkdir -p $BASE/log
fi
cd $BASE
find . -name "*.pyc" -delete
python manage.py migrate
if [ $? -ne 0 ]; then
echo "Can't start server"
exit 1
fi
python manage.py initadmin
python manage.py runserver 0.0.0.0:8080