1👍
✅
Define an environment variable. In Heroku’s case it looks like:
heroku config:set WORKING_ENVIRONMENT=HEROKU
And then check this variable in your code:
if os.environ['WORKING_ENVIRONMENT'] == 'HEROKU':
pass
else:
pass
Source:stackexchange.com