# encoding: utf-8 from fabric.api import local, run, env env.hosts = ['foobar.bar'] env.host = env.hosts[0] # hack to access this host easily env.user = ['foobar'] def test(): env.repo_path = "foobar_test" env.wsgi_path = "/var/www/wsgi-scripts/foobar_test.wsgi" def production(): env.repo_path = "foobar" env.wsgi_path = "/var/www/wsgi-scripts/foobar.wsgi" def deploy(): # push the code print local("hg push ssh://%(host)s/%(repo_path)s" % env) # update it remotely print run("cd %(repo_path)s; hg up" % env) # make apache reload the app to pick up changes print run("touch %(wsgi_path)s" % env)