Skip to content

Instantly share code, notes, and snippets.

@un33k
Created June 3, 2011 18:22
Show Gist options
  • Save un33k/1006866 to your computer and use it in GitHub Desktop.
Save un33k/1006866 to your computer and use it in GitHub Desktop.
Setup your virtualenv & virtualenvwrapper to create directory for each work item
#=== Add VirtualEnv =======
# add local bin to path
PATH=$HOME/projects/bin:$PATH
export PATH
# virtualevnwrapper
export VHOME_DIR=$HOME/projects
export WORKON_HOME=$VHOME_DIR/.$HOSTNAME-virenv
export PIP_DOWNLOAD_CACHE=$VHOME_DIR/.pip_cache_dir
source /usr/local/bin/virtualenvwrapper.sh
mkdir -p $WORKON_HOME > /dev/null 2>& 1
alias mkvenv='mkvirtualenv --no-site-packages'
#---- optional ------
# virtualenv aliases
# http://blog.doughellmann.com/2010/01/virtualenvwrapper-tips-and-tricks.html
alias v='workon'
alias v.deactivate='deactivate'
alias v.mk='mkvirtualenv --no-site-packages'
alias v.mk_withsitepackages='mkvirtualenv'
alias v.rm='rmvirtualenv'
alias v.switch='workon'
alias v.add2virtualenv='add2virtualenv'
alias v.cdsitepackages='cdsitepackages'
alias v.cd='cdvirtualenv'
alias v.lssitepackages='lssitepackages'
#=====================
#Install virtualenv and in .virevn directory ====
#add to: postactivate
#==================
#!/bin/bash
# This hook is run after every virtualenv is activated.
MY_PROJ=$(basename $VIRTUAL_ENV)
PROJ_PATH=~/projects/workon/$HOSTNAME/$MY_PROJ
mkdir -p $PROJ_PATH > /dev/null 2>&1
echo "Working on: $PROJ_PATH"
cd $PROJ_PATH
#=======
#the above will create a directory per work-item in a directoy on your choice.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment