问题
I have this code in my settings.py..
EMAIL_HOST = 'smtp.sendgrid.net'
EMAIL_HOST_USER = os.environ.get('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_HOST_PASSWORD')
I tried setting environment variable using this in heroku bash
export EMAIL_HOST_USER=xxx
and also
heroku config:set EMAIL_HOST_USER=xxx
None of the both method worked for me. How can i set environment variable in heroku?
回答1:
okk.. found the answer!!
instead of
heroku config:set EMAIL_HOST_USER=xxx
writing
heroku config:add EMAIL_HOST_USER=xxx
solves problem..
来源:https://stackoverflow.com/questions/34990128/how-to-set-environment-variables-in-heroku-django-project