Skip to content

Instantly share code, notes, and snippets.

@soyrex
Created September 21, 2011 22:35
Show Gist options
  • Save soyrex/1233517 to your computer and use it in GitHub Desktop.
Save soyrex/1233517 to your computer and use it in GitHub Desktop.
simple fab template for restarting remote django site
from fabric.context_managers import cd
from fabric.operations import sudo,run,local
from fabric.state import env
env.hosts = ['127.0.0.1',]
env.user = 'username'
env.deploy_user = 'django'
env.key_filename = ['/Users/soyrex/Keys/keyfile.pem',]
def stage():
local('git push origin staging')
with cd('/path/to/git/clone'):
sudo('git pull origin staging',user=env.deploy_user)
sudo('/etc/init.d/django-fcgi restart',user='root')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment