Issue
I want to be able to set up environment variables in my virtual environment so that they are available in my code when I activate the virtual environment. I make my virtual enviornments with venv. I'm working on a Windows machine with VS-code.
What I already tried, but didn't work.
- Adding the vars to end of the activate.bat file like this:
set CLIENT_SECRET="MYSECRET"
- Adding the vars to the end of the Activate.ps1 file like this:
$CLIENT_SECRET="MYSECRET"
- Adding the vars to the end of the activate file like this:
export CLIENT_SECRET="MYSECRET"
I found a lot related to my topic, but none working for me. What to do?
Solution
If you want to setup your development environment in VSCode you can simply add .env
file with all secrets defined in project root directory. More details in docs
Answered By - makozaki Answer Checked By - Marie Seifert (WPSolving Admin)