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.

24 lines
700 B

  1. #!/usr/bin/env bash
  2. set -o errexit
  3. echo "Making staticfiles"
  4. if [[ ! -d "app/staticfiles" ]]; then python app/manage.py collectstatic --noinput; fi
  5. echo "Initializing database"
  6. python app/manage.py wait_for_db
  7. python app/manage.py migrate
  8. python app/manage.py create_roles
  9. echo "Creating admin"
  10. if [[ -n "${ADMIN_USERNAME}" ]] && [[ -n "${ADMIN_PASSWORD}" ]] && [[ -n "${ADMIN_EMAIL}" ]]; then
  11. python app/manage.py create_admin \
  12. --username "${ADMIN_USERNAME}" \
  13. --password "${ADMIN_PASSWORD}" \
  14. --email "${ADMIN_EMAIL}" \
  15. --noinput \
  16. || true
  17. fi
  18. echo "Starting django"
  19. gunicorn --bind="0.0.0.0:${PORT:-8000}" --workers="${WORKERS:-1}" --pythonpath=app app.wsgi --timeout 300