2021-02-09 21:48:53 +00:00
|
|
|
#!/bin/sh
|
2021-02-28 22:03:32 +00:00
|
|
|
|
2021-02-09 21:48:53 +00:00
|
|
|
echo "Waiting for postgres..."
|
2021-02-28 22:03:32 +00:00
|
|
|
|
2021-02-09 21:48:53 +00:00
|
|
|
POSTGRES_PORT=${POSTGRES_PORT:-5432}
|
|
|
|
POSTGRES_HOST=${POSTGRES_HOST:-localhost}
|
|
|
|
|
|
|
|
while ! nc -z "$POSTGRES_HOST" "$POSTGRES_PORT"; do
|
|
|
|
sleep 0.1
|
|
|
|
done
|
2021-02-28 22:03:32 +00:00
|
|
|
|
2021-02-09 21:48:53 +00:00
|
|
|
echo "PostgreSQL started"
|
2021-02-28 22:03:32 +00:00
|
|
|
|
2021-02-28 22:55:01 +00:00
|
|
|
# Only migrate, collectstatic and compilemessages if we are NOT in development
|
2021-02-09 21:48:53 +00:00
|
|
|
if [ -z "$DEBUG" ]; then
|
2021-02-28 22:55:01 +00:00
|
|
|
python manage.py migrate;
|
2021-02-09 21:48:53 +00:00
|
|
|
python manage.py collectstatic --no-input;
|
2021-02-28 22:55:01 +00:00
|
|
|
python manage.py compilemessages;
|
2021-02-09 21:48:53 +00:00
|
|
|
fi
|
|
|
|
|
2021-02-28 22:03:32 +00:00
|
|
|
exec "$@"
|