I’m using the Heroku cedar stack to run my Django application, and I’d like to have a different configuration when I’m running in Heroku than when I’m running locally. For now, settings.py is my Heroku-specific configuration, and I’m using local_settings.py for non-Heroku stuff, and leaving it out of version control.
However, I’d like to do something like this in settings.py:
if in_heroku:
CONFIG_VAL='this'
else:
CONFIG_VAL='that'
Any ideas how to detect that I’m in the Heroku environment in settings.py?
You’re looking at configuration wrong.
Ideally your environment should dictate your configuration settings, so that you don’t need to worry about customizing your code for the specific environment.
Read up on these: