Answer the question
In order to leave comments, you need to log in
How to properly hide the token?
There is a
Config.py file, it contains:
access_token = "here is the token itself"
And there is a main.py file that reads the config via config.access_token
How can I remove the token from the repository, but put it in the secrets section, I want to open the code, but if I remove the token completely, then I won’t be able to deploy to Heroku
Answer the question
In order to leave comments, you need to log in
Save it to heroku environment variable and call it via:
os.environ['var_name']
Menu item "Settings" in Heroku admin panel:
Click "Reveal Config Vars" button, add environment variables:
Or via Heroku CLI ( https://devcenter.heroku.com/articles/config-vars ):
heroku config:set GITHUB_USERNAME=joesmith
Adding config vars and restarting myapp... done, v12
GITHUB_USERNAME: joesmith
access_token = os.getenv("ACCESS_TOKEN")
...
We store all such information in server environment variables, this is also possible on Heroku.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question