diff --git a/app/entrypoint.sh b/app/entrypoint.sh index 06e344d..deac35e 100644 --- a/app/entrypoint.sh +++ b/app/entrypoint.sh @@ -1,9 +1,6 @@ #!/bin/sh -echo "Waiting for postgres..." python wait_for_db.py -echo "PostgreSQL started" - python manage.py makemigrations python manage.py migrate python manage.py collectstatic --noinput diff --git a/app/wait_for_db.py b/app/wait_for_db.py index 6ece4e2..fd6f73e 100644 --- a/app/wait_for_db.py +++ b/app/wait_for_db.py @@ -4,7 +4,7 @@ import os port = int(os.environ.get("SQL_PORT")) # 5432 db_name = os.environ.get("SQL_HOST") -print(f"database at {db_name}:{port}") +print(f"Waiting for database at {db_name}:{port}") s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) while True: @@ -13,4 +13,6 @@ while True: s.close() break except socket.error: - time.sleep(0.1) \ No newline at end of file + time.sleep(0.1) + +print(f"Database active") \ No newline at end of file