Skip to content

Instantly share code, notes, and snippets.

@Lauriy
Created July 29, 2024 21:03
Show Gist options
  • Save Lauriy/fcc64f98beb570e386a6273cb41032d6 to your computer and use it in GitHub Desktop.
Save Lauriy/fcc64f98beb570e386a6273cb41032d6 to your computer and use it in GitHub Desktop.
Docker entrypoint that runs either Django runserver, pytest, or uwsgi
#!/bin/bash
set -e
python manage.py migrate --noinput
case "$DJANGO_ENV" in
"development")
python manage.py loaddata rik_proovitöö/fixtures/superuser.json
python manage.py loaddata rik_proovitöö/fixtures/legal_entity.json
python manage.py loaddata rik_proovitöö/fixtures/equity.json
exec python manage.py runserver 0.0.0.0:8000
;;
"test")
exec pytest
;;
"production")
python manage.py collectstatic --noinput
exec uwsgi --ini /home/docker/rik_proovitöö/uwsgi.ini
;;
*)
echo "DJANGO_ENV must be set to 'development', 'test', or 'production'"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment