I am building a system that uses API tokens and keys to access services, but where is the best place to store them? I want to push the code to GitHub without pushing the tokens.
Currently, I've placed them in a blank file named Constants.py
and, in the main python file, I import Constants.py
.
API_KEY_SERVICE = "ABC123ABC"
Main.py:
import Constants
service_key = Constants.API_KEY_SENDGRID
.gitignore
to prevent accidental commits and pushes. – Brachiate.gitignore
. – Joceline