[Answer]-How to run different code in django based on heroku deployment

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

Leave a comment