File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ if [ -z ${POSTGRES_DB+x} ]; then
6+ echo " PostgreSQL is not used. Skipping wait-for-it..." ;
7+ echo " Using SQLite. Creating database..." ;
8+ else
9+ echo " Using PostgreSQL. Waiting for it to be ready..." ;
10+ /opt/venv/bin/wait-for-it -s " $POSTGRES_HOST :$POSTGRES_PORT " -t 60
11+ echo " PostgreSQL is ready." ;
12+ fi
13+
14+ echo " Running makemigrations..."
15+ /opt/venv/bin/python /app/src/manage.py makemigrations --noinput
16+ echo " Completed makemigrations."
17+
18+ echo " Running migrate..."
19+ /opt/venv/bin/python /app/src/manage.py migrate --noinput
20+ echo " Completed migrate."
21+
22+ echo " Running CreateSuperUser..."
23+ USER_EXISTS=" from django.contrib.auth import get_user_model; User = get_user_model(); exit(User.objects.exists())"
24+ /opt/venv/bin/python /app/src/manage.py shell -c " $USER_EXISTS " && /opt/venv/bin/python /app/src/manage.py createsuperuser --noinput
25+ echo " Completed CreateSuperUser."
26+
27+ echo " Running collectstatic..."
28+ /opt/venv/bin/python /app/src/manage.py collectstatic --noinput
29+ echo " Completed collectstatic."
30+
31+ exec " $@ "
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ cd /app/src
4+
5+ APP_PORT=${GUNICORN_PORT:- 8000}
6+
7+ if [ " $1 " = " --debug" ]; then
8+ /opt/venv/bin/python /backend/manage.py runserver " 0.0.0.0:$APP_PORT "
9+ else
10+ /opt/venv/bin/gunicorn " backend.wsgi:application" --bind " 0.0.0.0:$GUNICORN_PORT " --workers " $GUNICORN_WORKERS " --timeout " $GUNICORN_TIMEOUT " --log-level " $GUNICORN_LOG_LEVEL "
11+ fi
You can’t perform that action at this time.
0 commit comments