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.

29 lines
776 B

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