Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to define the postactivate hook with virtualenvwrapper-win?

I'm using virtualenvwrapper-win and want to use the postactivate hook of virtualenvwrapper to set environment variables. However it seems virtualenvwrapper-win doesn't include a postactivate file, and I haven't been able to get it to work by creating my own. Does anybody know how to get the postactivate hook to work with virtualenvwrapper-win?

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

like image 966
lonkeknol Avatar asked Dec 17 '14 23:12

lonkeknol


2 Answers

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

like image 163
lonkeknol Avatar answered Nov 07 '22 09:11

lonkeknol


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 above :END

like image 1
Dan Cohen Avatar answered Nov 07 '22 09:11

Dan Cohen