Created
March 28, 2016 09:20
-
-
Save NamPNQ/f9c9ccbe35370f36e117 to your computer and use it in GitHub Desktop.
fabric with virtualenv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fabric.api import lcd, local, path | |
project_dir = '/www/my_project/sms/' | |
env_bin_dir = project_dir + '../env/bin/' | |
def deploy(): | |
with lcd(project_dir): | |
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') # Django related | |
# Note: previous line is the same as: | |
local('python manage.py migrate') | |
# Using next line, you can make sure that python | |
# from virtualenv directory is used: | |
local('which python') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment