Where to define a postactivate hook with virtualenvwrapper-win?

I am using virtualenvwrapper-win and want to use the postactivate hook virtualenvwrapper to set environment variables. However, virtualenvwrapper-win does not seem to include the postactivate file, and I could not get it working by creating my own. Does anyone know how to make postactivate hook work with virtualenvwrapper-win?

I want to include this in postactivate to set the environment variable: SET APP_SETTINGS="example.setting"

+6
source share
2 answers

I really decided it myself. You can put any environment variables in the activate.bat file in the Scripts folder of your virtualenv.

+3
source

If you have already defined your VIRTUALENVWRAPPER_HOOK_DIR variable, just add this line to workon.bat .

 call "%VIRTUALENVWRAPPER_HOOK_DIR%\postactivate.bat" 

Just make sure you put it higher :END

0
source

Source: https://habr.com/ru/post/979814/


All Articles