SCRIPT=$(readlink -f ${PWD}/${BASH_SOURCE})
TOP_PATH=`dirname $SCRIPT`

if ! [ -e $TOP_PATH/env/bin/activate ]; then
  if [ -n "${VIRTUAL_ENV+x}" ]; then
    deactivate
  fi
  virtualenv --unzip-setuptools --no-site-packages --distribute "$TOP_PATH/env"
  $TOP_PATH/env/bin/pip install -r requirements.txt
fi

source $TOP_PATH/env/bin/activate
export mg="$TOP_PATH/env/bin/python $TOP_PATH/sites/manage.py"
