brew update
brew upgrade
brew install python3
pip3 install virtualenvwrapper
add the following to your ~/.bash_profile
:
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Projects
export VIRTUALENVWRAPPER_PYTHON='/usr/local/bin/python3'
source /usr/local/bin/virtualenvwrapper.sh
Then create and activate the virtual environment:
git clone git@github.com:your-user-name/your-project.git
# or just git pull
cd /projects/your_project
mkvirtualenv your_project --python=/usr/local/bin/python3
workon your_project
You can add this to ~/.virtualenvs/your-project/bin/postactivate
so the env vars get imported to the command line directly from .envs
:
#!/bin/bash
# This hook is sourced after this virtualenv is activated.
if [ -f ${PWD}/.env ]; then
echo "activating .env..."
set -a
. ${PWD}/.env
set +a
fi
In some projects there might be an .env-example
file. Copy it to .env
and update the sample values inside.
pip install -r requirements.txt
pip install -r requirements-dev.txt
# migrate the db
./manage.py migrate