forked from data.coop/membersystem
Thomas Jespersen
6857bc69b5
Apparently I forgot to add this file in previous commits - the initial shape is provided by @valberg, I added some defaults for POSTGRES_{HOST,PORT}.
22 lines
399 B
Bash
Executable file
22 lines
399 B
Bash
Executable file
#!/bin/sh
|
|
|
|
echo "Waiting for postgres..."
|
|
|
|
POSTGRES_PORT=${POSTGRES_PORT:-5432}
|
|
POSTGRES_HOST=${POSTGRES_HOST:-localhost}
|
|
|
|
while ! nc -z "$POSTGRES_HOST" "$POSTGRES_PORT"; do
|
|
sleep 0.1
|
|
done
|
|
|
|
echo "PostgreSQL started"
|
|
|
|
# Only migrate and collectstatic if we are NOT in development
|
|
if [ -z "$DEBUG" ]; then
|
|
python manage.py migrate
|
|
python manage.py collectstatic --no-input;
|
|
fi
|
|
|
|
exec "$@"
|
|
|