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.

28 lines
751 B

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