Skip to content

Instantly share code, notes, and snippets.

@oyakata
Created February 28, 2013 09:23
Show Gist options
  • Save oyakata/5055451 to your computer and use it in GitHub Desktop.
Save oyakata/5055451 to your computer and use it in GitHub Desktop.
fabricのお役立ちコンテキストマネージャ ref: http://qiita.com/items/d848a7e0a6271baa722d
import fabric.api as api
with api.env_shell("PYTHONPATH=. DJANGO_SETTINGS_MODULE=settings.imagawa"):
api.run("python dosomething.py")
import fabric.api as api
with api.prefix(". /home/www/bin/activate"):
fabric.api.run("./manage.py syncdb")
import fabric.api as api
with api.path("/usr/local/bin", behavior="prepend"):
api.run("python -V")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment