diff --git a/deploy/docker/prestart.sh b/deploy/docker/prestart.sh index a8ddfdeb..655a8eec 100755 --- a/deploy/docker/prestart.sh +++ b/deploy/docker/prestart.sh @@ -6,8 +6,7 @@ ADMIN_PASSWORD=${ADMIN_PASSWORD:-$RANDOM_ADMIN_PASS} if [ X"$ENABLE_MIGRATIONS" = X"yes" ]; then echo "Running migrations service" python manage.py migrate - EXISTING_INSTALLATION=`echo "from users.models import User; print(User.objects.exists())" |python manage.py shell 2>/dev/null | tail -1` - if [ "$EXISTING_INSTALLATION" = "True" ]; then + if DJANGO_SETTINGS_MODULE=cms.settings python -c "import django, sys; django.setup(); from users.models import User; sys.exit(0 if User.objects.exists() else 1)" 2>/dev/null; then echo "Loaddata has already run" else echo "Running loaddata and creating admin user"