I have virtualenv setup and it is working well accept for one annoying issue. when I use the workon command to enter an environment the environment is logs in correctly but I do not get automatically directed to the environments root directory.
I have added the following lines to my .bashrc
file:
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
and reloaded it (source .bashrc
), but when I enter an environment I am still left in my ubuntu user home directory. I have also tries restarting my server, but still no luck.
I don't think workon
changes to the environment directory. The solution would is to put that in postactivate
file of your virtualenv.
E.g. I have following in my <virtual_env_dir>/bin/postactivate
cd /home/myuser/work/
Environments are separate from projects with virtualenvwrapper. You first need to ensure that the $PROJECT_HOME
variable is set. Then you can use the mkproject
command to create an environment and a project in `$PROJECT_HOME'. Alternatively, you can use setvirtualenvproject to associate an existing project with an existing virtual environment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With