Skip to content

Instantly share code, notes, and snippets.

@darklow
Last active December 22, 2015 17:49
Show Gist options
  • Save darklow/6508370 to your computer and use it in GitHub Desktop.
Save darklow/6508370 to your computer and use it in GitHub Desktop.
Django local server deployment with Fabric and virtualenv
from fabric.api import lcd, local, path
project_dir = '/www/project/sms/'
env_bin_dir = project_dir + '../env/bin'
def deploy():
with lcd(project_dir):
local('pwd')
local('git pull origin')
local('git checkout -f')
with path(env_bin_dir, behavior='prepend'):
local('pip freeze')
local('pip install -r requirements/staging.txt')
local('./manage.py migrate --settings="project.settings.staging"')
local('./manage.py collectstatic -cl --noinput -v0')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment