Recommended steps to do prior to deploying your application
Generate a unique Django secret key for each environment
To do this using Django's built-in
startproject algorithm, open up a Django shell and run the following Python code:
from django.core.management.utils import get_random_secret_key get_random_secret_key()
If you are using the compose setup, you can run the Python code above in your container like so:
docker-compose exec app python manage.py shell
SECRET_KEY in your environment to this value
The Dockerfile will install Django requirements based on an optional argument for
ENVIRONMENT. If unset, it will default to "PRODUCTION" and packages will be installed from requirements.prod.txt.
Prior to deployment, it is recommended that you
pip freeze and copy the exact versions to requirements.prod.txt to prevent unintended side-effects.
If using compose, you can run:
docker-compose exec app pip freeze > requirements.prod.txt
(Optional) Update settings for Django error emails
Set the following environment variables:
The EMAIL_HOST should be vdc-relay.us-east-2.a.mail.umich.edu if deployed in the UM OpenShift cluster, otherwise set to mail-relay.itd.umich.edu
The EMAIL_SUBJECT_PREFIX is prepended to the email subject to designate which environment the email is coming from, e.g. Development, Production, etc.
(Optional) Tweak Gunicorn settings
The number of workers and threads can be set via environment variables,
There is an article here that suggests that
maximum concurrent requests when using workers and threads is still(2*CPU)+1
You may want to update these values based on the available server resources.