For doing updates, this is all you need: from fabric.api import *
def prod():
env.hosts = ['1.1.1.1']
env.user = 'user'
env.password = 'password'
def update():
run('cd /var/web2py/applications/init; hg pull')
run('cd /var/web2py/applications/init; hg update')
Then at the command line: $ fab prod update

