#!/bin/sh set -e set -u #set -x _subs() { key="${1}" value="${2}" file="${3}" sed -i "s/^\(${key} =\).*/\1 '${value}'/" "${file}" } # go to the same path as the script cd "$(dirname ${0})" SECRET_KEY=${SECRET_KEY} ALLOWED_HOSTS=${ALLOWED_HOSTS:-*} # override settings with env vars defined in docker settings_file='panel/settings.py' _subs 'ALLOWED_HOSTS' "${ALLOWED_HOSTS}" "${settings_file}" _subs 'SECRET_KEY' "${SECRET_KEY}" "${settings_file}" # move the migrate thing in docker entrypoint # inspired by https://medium.com/analytics-vidhya/django-with-docker-and-docker-compose-python-part-2-8415976470cc #python3 manage.py migrate expect -f ./orchestra.migrate.exp ./manage.py runserver 0.0.0.0:9080