Sample settings.json
file:
{
"DEBUG": true,
"TIME_ZONE": "America/New_York"
}
Use get_setting()
when retrieving environment variables on your settings.py
file:
from settings_json import get_setting
DEBUG = get_setting('DEBUG')
TIME_ZONE = get_setting('TIME_ZONE')
Remember to add settings.json
into your .gitignore
, so it doesn't get tracked.
settings.json
If you forget to add a variable on your settings.json
, it'll raise an error like the one below:
Set the TIME_ZONE environment variable on settings.json