From 0fbdf05ebcc6641c2be4ecff8c466928ee37a899 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Wed, 5 Jun 2024 14:48:08 +0100 Subject: Implement a try except in the entrypoint script --- docker-entrypoint.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'docker-entrypoint.sh') diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 1cf95db..899df63 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,6 +1,15 @@ #!/bin/sh cd /app + +# Run migrations python manage.py migrate -python manage.py createsuperuser --noinput + +# Try to create a superuser, skip if email is already taken +echo "Attempting to create superuser..." +python manage.py createsuperuser --noinput || true + +# Collect static files python manage.py collectstatic --noinput + +# Start Gunicorn exec gunicorn --bind ':8080' --workers 3 ded.wsgi:application -- cgit v1.2.3