Skip to content

Instantly share code, notes, and snippets.

@acslater00
Created August 21, 2011 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acslater00/1161090 to your computer and use it in GitHub Desktop.
Save acslater00/1161090 to your computer and use it in GitHub Desktop.
Fabric
from fabric.api import *
env.hosts = ['acslater@hostname.com]
def deploy(staging="/home/acslater/staging/iris", target="/home/acslater/irisforwestchester.com/"):
# pull latest code
with cd(staging):
run("git pull origin master")
# create directories if don't exist
with cd(target):
run("mkdir -p iris")
run("mkdir -p public")
# copy things
with cd(staging):
# passenger file into home directory
run("cp passenger_wsgi.py {0}".format(target))
# to move into "public directory"
tomove_public = (
"media", # media directory, complete
"templates" # templates directory, complete
)
for elem in tomove_public:
run("cp -r {0} {1}/public".format(elem, target))
# to move into "iris" directory
tomove_iris = (
"*.py",
"python/iris/*.py"
)
for elem in tomove_iris:
run("cp -r {0} {1}/iris".format(elem, target))
# restart python remotely...
run("pkill python")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment