You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
673 B

  1. #!/usr/bin/env bash
  2. set -o errexit
  3. if [[ -z "${VIRTUAL_ENV}" ]]; then
  4. source "$(pipenv --venv)/bin/activate"
  5. fi
  6. #root="$(dirname "$0")/.."
  7. #app="${root}/app"
  8. app="/src/app"
  9. echo "Initializing database"
  10. python "${app}/manage.py" wait_for_db
  11. python "${app}/manage.py" migrate
  12. python "${app}/manage.py" create_roles
  13. if [[ -n "${ADMIN_USERNAME}" ]] && [[ -n "${ADMIN_PASSWORD}" ]] && [[ -n "${ADMIN_EMAIL}" ]]; then
  14. python "${app}/manage.py" create_admin \
  15. --username "${ADMIN_USERNAME}" \
  16. --password "${ADMIN_PASSWORD}" \
  17. --email "${ADMIN_EMAIL}" \
  18. --noinput \
  19. || true
  20. fi
  21. echo "Starting django"
  22. python -u "${app}/manage.py" runserver 0.0.0.0:8000