In .profile
found at /home/myuser/
, I set an environment variable as follows: export API_TOKEN=xxxxyyyyxxxxyyyyyxxxxxyyyyyxx
, and then running source ~/.profile
.
This server has a Django app on it; where I import the env variable in settings.py
(via API_TOKEN = os.environ.get('API_TOKEN','1')
) and then use it to call an analytics API I'm using for my app.
The problem is that Django is unable to import the token at all.
When I do env
in the terminal, I do see API_TOKEN=xxxxyyyyxxxxyyyyyxxxxxyyyyyxx
among the list of environment variables printed. What could be going wrong, and how can I diagnose the problem?
Note that I do not see the token printed if I do env
in super user. Could that be an issue? But there are several other env variables I'm using in this way, and those import correctly even though they don't appear for super user.