Matt Seymour

Ways to use environment variables in Django.

  1. Store settings in environment variables

By storing settings in environment variables you can freely store your project on machines without the extra precautions relating to sensitive information.

Storing items like your SECRET_KEY, and database passwords within the environment variables mean they can be set on a per-environment basis.



Storing environment variables:

My single biggest annoyance with environment variables are setting them when provisioning or running a server in production. My personal solution is to use envvars a small package I created for handling environment variables when running applications as different users.