I am creating a Python app and hosting it on Heroku. Recently I have been playing around with Heroku's Config Vars so that I can keep my secret keys away from prying eyes. So I put my secret key in the Heroku config vars:
And then in my Python code, I access the secret var using something like this:
print("This is my secret key: " + str(os.environ.get("secret_key")))
And when hosted on Heroku, that works great!
>>>This is my secret key: 1234
But I would also like to be able to run this code local in PyCharm. Typically I would just do something like:
secret_key = sys.argv[1]
And set the secret key in the script parameters of PyCharm. But that will not run on Heroku. Is there something that I can put in the script parameters to make this work? Something like this? (tried, does not work...)
Or is there some other way to go about this?