11#! /bin/bash
22
3+ # Wait until Database is available before continuing
4+ printf " \n" && echo " Checking Database is up"
5+ # using psql
6+ while ! pg_isready -q -h $POSTGRES_HOST -p $POSTGRES_PORT -U $POSTGRES_USER
7+ do
8+ echo " $( date) - waiting for database to start"
9+ sleep 1
10+ done
11+
12+ >&2 echo " Postgres is up - continuing"
13+
314echo " Applying database migrations"
4- python manage.py migrate --noinput
15+ uv run python manage.py migrate --noinput
516
617echo " Collecting static files"
7- python manage.py collectstatic --noinput
18+ uv run python manage.py collectstatic --noinput
819
920# Create Django Superuser
1021echo " Creating Django Superuser"
11- python manage.py createsuperuser --noinput
22+ uv run python manage.py createsuperuser --noinput
1223
1324# Run inbuilt Django server if ENV is development
1425if [ " ${APP_ENV^^} " = " DEVELOPMENT" ]; then
1526
1627 # Install extra non-prod packages
1728 printf " \n" && echo " Installing dev dependencies for $APP_ENV "
18- uv sync
29+ uv sync --frozen --all-groups
1930 # Run developments
2031 printf " \n" && echo " Starting inbuilt django webserver"
2132 echo " Running: python manage.py runserver 0.0.0.0:8081"
22- python manage.py runserver 0.0.0.0:8081
33+ uv run python manage.py runserver 0.0.0.0:8081
2334 exit
2435fi
2536
@@ -30,6 +41,6 @@ if [ "${APP_ENV^^}" = "PRODUCTION" ]; then
3041
3142 # Run Gunicorn / Django
3243 printf " \n" && echo " Running Gunicorn / Django"
33- echo " Running: gunicorn api .wsgi -b 0.0.0.0:8081 --workers=6 --keep-alive 20 --log-file=- --log-level debug --access-logfile=/var/log/accesslogs/gunicorn --capture-output --timeout 50"
34- gunicorn api .wsgi -b 0.0.0.0:8081 --workers=6 --keep-alive 20 --log-file=- --log-level debug --access-logfile=/var/log/accesslogs/gunicorn --capture-output --timeout 50
35- fi
44+ echo " Running: gunicorn server .wsgi -b 0.0.0.0:8081 --workers=6 --keep-alive 20 --log-file=- --log-level debug --access-logfile=/var/log/accesslogs/gunicorn --capture-output --timeout 50"
45+ uv run gunicorn server .wsgi -b 0.0.0.0:8081 --workers=6 --keep-alive 20 --log-file=- --log-level debug --access-logfile=/var/log/accesslogs/gunicorn --capture-output --timeout 50
46+ fi
0 commit comments