Django remote deployment with buildout and Fabric

2019-08-12 00:14发布

I am writing a web application using Django, on djangorecipe. I wanted to have an automatic deployment and found out that Fabric would be a perfect solution.

I am not sure though, how do you use Fabric in buildout environment. It turned out that the buildout recipes and posts on using Fabric are a bit outdated (ca. 2010). Has anyone tried implementing that?

1条回答
ら.Afraid
2楼-- · 2019-08-12 01:02

Best way to think about it is to treat them as separate.

  • Buildout is for setting everything up, both locally and on the server. Grabbing django and all needed python packages. Perhaps even generate an apache config file from a template.

  • fabric is for running remote commands, like checking out your tag with buildout in it on the server, running bootstrap and buildout and for restarting apache for instance.

Buildout manages the actual directory. Fabric runs buildout and manages everything outside of the buildout dir. Works like a charm!

(And of course you put your fabfile.py inside your buildout dir. And you can add fabric itself to a zc.recipe.egg:scripts part to get a local bin/fab in case you prefer that.)

查看更多
登录 后发表回答