Skip to content

Instantly share code, notes, and snippets.

@mike1e
Last active December 29, 2015 05:09
Show Gist options
  • Save mike1e/7619662 to your computer and use it in GitHub Desktop.
Save mike1e/7619662 to your computer and use it in GitHub Desktop.
switch folders with virtualenv
# In the postmkvirtualenv script I have the following to create a directory based on the project name,
# add that directory to the python path and then cd into it:
proj_name=$(echo $VIRTUAL_ENV|awk -F'/' '{print $NF}')
mkdir $HOME/projects/$proj_name
add2virtualenv $HOME/projects/$proj_name
cd $HOME/projects/$proj_name
# In the postactivate script I have it set to automatically change to the project
# directory when I use the workon command:
proj_name=$(echo $VIRTUAL_ENV|awk -F'/' '{print $NF}')
cd ~/projects/$proj_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment