django-docker-test/djangoproject/entrypoint.sh

20 lines
460 B
Bash
Executable File

#!/bin/sh
if [ "$DATABASE" = "postgres" ]; then
echo "Waiting for postgres..."
while ! nc -z $DATABASE_HOST $DATABASE_PORT; do
sleep 0.1
done
echo "PostgreSQL started"
fi
# Make migrations and migrate the database.
echo "Making migrations and migrating the database"
python manage.py makemigrations main --noinput
python manage.py migrate --noinput
echo "collectiong static files"
python manage.py collectstatic --noinput
exec "$@"