I am trying to deploy my django app on Heroku, but the issue is that I cannot access my config vars from python code.
Here are my config vars (obfuscated for obvious reasons)
$ heroku config --remote production
=== myapp Config Vars
DATABASE_URL: postgres://<removed>
DJANGO_DEBUG: 0
GOOGLE_APPLICATION_CREDENTIALS: <removed>
SECRET_KEY: <removed>
Now, in my django settings.py, the code
import os
os.environ["DJANGO_DEBUG"]
for example results in an error because the key "DJANGO_DEBUG" is nowhere to be found in the dictionary os.environ.
My question is: how can I access Heroku config variables in production?
I have tried the package python-decouple, but it is not able to access the config vars neither. (Locally, my variables are put in a .env file and are accessible with the help of the package python-decouple)
Edit: I actually realized that the config variables are accessible from my app and from the command if I run bash from within the app page on heroku, but there are not accessible if I run python on an ssh session, i.e., if I run python like this:
$heroku ps:exec
$python
os.environ does not contain my config variables.
Thank you for your help!