I want to add some global environment variables in my Python project. My thought was to add a .env
in my project directory and set up some variables as follows:
URL='https://example.dev/api'
AUTHORIZATION='Basic QWERTYUIO234ERTY89IOKXCVB'
In Python, how would I be able to access those variables in my project. Online I've seen seen os.getenv('URL')
, where os
is also imported, but this doesn't seem to be working. Does anyone know how I might be able to do this? I could also set up an appSettings
file to contain these global variables. Alternatively, if there's a better practice to use for Python, could someone please share?