-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·29 lines (24 loc) · 910 Bytes
/
build.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
26
27
28
29
#!/usr/bin/env bash
# Exit on error
set -o errexit
# Modify this line as needed for your package manager (pip, poetry, etc.)
echo "Installing Dependacies"
pipenv install
# Apply any outstanding database migrations
echo "Running Migrations"
python manage.py migrate
# Print environment variable values
echo "ENV VARS"
echo "CREATE_SUPERUSER: $CREATE_SUPERUSER"
echo "DJANGO_SUPERUSER_USERNAME: $DJANGO_SUPERUSER_USERNAME"
echo "DJANGO_SUPERUSER_EMAIL: $DJANGO_SUPERUSER_EMAIL"
echo "DJANGO_SUPERUSER_PASSWORD: $DJANGO_SUPERUSER_PASSWORD"
# Create superuser
echo "Creating superuser"
if [ "$CREATE_SUPERUSER" = "True" ]; then
python manage.py shell <<EOF
from django.contrib.auth.models import User
if not User.objects.filter(username='$DJANGO_SUPERUSER_USERNAME').exists():
User.objects.create_superuser('$DJANGO_SUPERUSER_USERNAME', '$DJANGO_SUPERUSER_EMAIL', '$DJANGO_SUPERUSER_PASSWORD')
EOF
fi