I am novice in IT. Sorry for possible stupid question.
I want to check wether python-dotenv really creates environment variable.
So I add .env file with my MYVAR.
Then I execute python file within code: import dotenv; dotenv.load_dotenv(); import os; os.environ['MYVAR']
and get correct value.
But if I further check echo $MYVAR
in Terminal - where is no such variable.
Is the python-dotenv really creates the env.v. or just implement its own way to parse pairs key-value?
How to check wether a python-dotenv creates the environmet variable?
712 Views Asked by Ruslan Mansurov At
1
Here's what I understand from the docu:
So dotenv will set environment variables only for the process in which it runs. The idea is to support development of applications that use environment variables. See also https://12factor.net/config.
It is not the use case for dotenv to permanently set environment variables. You would rather do that with specific tools of your operating system.
Your test confirms that setting environment variables for an application works. But the values are not set permanently. They are not visible outside the application or after it ends (and not intended to be).