问题描述
我正在使用Django在djangorecipe上编写一个Web应用程序。我想要自动部署,发现Fabric将是一个完美的解决方案。我不确定,如何在构建环境中使用Fabric。事实证明,使用Fabric的增加配方和帖子有点过时了(大约2010)。有没有人试过实现?
最好的思路是将它们视为单独的。
-
Buildout用于在本地和服务器上设置所有内容。抓取django和所有需要的python包。甚至可以从模板生成一个apache配置文件。
-
fabric用于运行远程命令,例如使用服务器上的buildout来检查您的标签,运行引导和构建,并重新启动apache。 / p>
Buildout管理实际目录。 Fabric运行buildout并管理buildout目录之外的所有内容。工作就像一个魅力!
(当然你把你的fabfile.py放在你的buildout目录里,你可以把自己添加到zc.recipe.egg中:脚本一部分得到一个本地的bin / fab,以防你喜欢。)
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?
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.)
这篇关于Django使用buildout和Fabric进行远程部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!