-
Notifications
You must be signed in to change notification settings - Fork 22
/
startup.sh
25 lines (19 loc) · 688 Bytes
/
startup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env bash
# https://github.com/doccano/doccano/blob/v1.0.5/tools/run.sh
set -o errexit
# start model serving in background
echo "Starting alpaca-serving"
alpaca-serving-start &
sleep 3 && echo -e '\n\n'
echo "Running migrations on '$DATABASE_URL'"
python manage.py migrate
echo "Creating admin"
if [[ -n "${ADMIN_USERNAME}" ]] && [[ -n "${ADMIN_PASSWORD}" ]] && [[ -n "${ADMIN_EMAIL}" ]]; then
DJANGO_SUPERUSER_PASSWORD=$ADMIN_PASSWORD python manage.py createsuperuser \
--username "${ADMIN_USERNAME}" \
--email "${ADMIN_EMAIL}" \
--noinput \
|| true # skip if already existing
fi
echo "Starting django"
python manage.py runserver "0.0.0.0:${PORT:-8000}"