#!/bin/sh set -e set -u set -x main() { idhub_dir='/opt/idhub' cd "${idhub_dir}" if [ ! -f "./manage.py" ]; then cat <&2 ./manage.py initial_datas else printf "creating superuser \n user: ${DJANGO_SUPERUSER_USERNAME}\n password: ${DJANGO_SUPERUSER_PASSWORD}\n email: ${DJANGO_SUPERUSER_EMAIL}\n" >&2 ## thanks https://stackoverflow.com/questions/6244382/how-to-automate-createsuperuser-on-django/59467533#59467533 ./manage.py createsuperuser --no-input fi fi # enable dev flags when DEVELOPMENT deployment if [ "${DEPLOYMENT}" = 'DEVELOPMENT' ]; then export DEBUG=True export DEVELOPMENT=True fi #./manage.py collectstatic ./manage.py runserver 0.0.0.0:${PORT} } main "${@}"