33 lines
698 B
Bash
Executable File
33 lines
698 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
function wait_service {
|
|
while ! nc -z $1 $2; do
|
|
sleep 1
|
|
done
|
|
}
|
|
|
|
case $1 in
|
|
run-migrations)
|
|
echo "--> Applying migrations"
|
|
wait_service $MYSQL_HOST $MYSQL_PORT
|
|
cd $DOCUMENTROOT
|
|
exec python manage.py migrate --noinput
|
|
;;
|
|
run-server)
|
|
echo "--> Starting Django's server"
|
|
wait_service $MYSQL_HOST $MYSQL_PORT
|
|
exec python manage.py runserver 0.0.0.0:$APP_PORT
|
|
;;
|
|
run-tests)
|
|
echo "--> Starting Django's test framework"
|
|
wait_service $MYSQL_HOST $MYSQL_PORT
|
|
cd $DOCUMENTROOT
|
|
exec python manage.py test
|
|
;;
|
|
*)
|
|
exec "$@"
|
|
;;
|
|
esac
|