I created a bot for Discord in python. The bot requires a token for connection to my server and i don't want to store the token in a python file, because everyone would see it on github.
I added an Enviroment variable for my bot token with the same variable name as in the python file (BOT_TOKEN), but the OpenShift doesn't recognizes it.
I got the following error:
---> Running application from Python script (main.py) ...
Traceback (most recent call last):
File "main.py", line 22, in <module>
client.run(BOT_TOKEN)
NameError: name 'BOT_TOKEN' is not defined
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f001d95fdd8>
How can i set a variable for my bot token without uploading it to github?
(Sorry for my English)
Assuming that you have added the environment variable correctly, shouldn't your code be
client.run(os.environ.get('BOT_TOKEN')
?