Skip to content

Instantly share code, notes, and snippets.

@ephdtrg
Last active March 21, 2022 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ephdtrg/44c900ac703685eff6b64195d76425a9 to your computer and use it in GitHub Desktop.
Save ephdtrg/44c900ac703685eff6b64195d76425a9 to your computer and use it in GitHub Desktop.
Shell script for running Django in runserver / gunicorn mode, based on config.yaml parameter of DEBUG
#!/bin/bash
source .env
debug=$(cat config.yaml | shyaml get-value debug)
echo "Starting server, debug mode: $debug"
if [ $debug = "True" ]; then
poetry run python manage.py runserver 0.0.0.0:$DJANGO_PORT
else
gunicorn --bind :$DJANGO_PORT --workers 8 project.wsgi:application
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment