[英]What do I need to know/learn for automated python deployment?
I'm starting a new webapp project in Python to get into the Agile mind-set and I'd like to do things "properly" with regards to deployment. 我正在用Python开始一个新的webapp项目,以进入敏捷思维模式,我想在部署方面做“正确”的事情。 However, I'm finding the whole virtualenv/fabric/zc.buildout/etc stuff a little confusing - I'm used to just FTP'ing PHP files to a server and pointing a webserver at it.
但是,我发现整个virtualenv / fabric / zc.buildout / etc的东西有点令人困惑 - 我习惯于只是将PHP文件FTP到服务器并将Web服务器指向它。
After deployment the server set-up would look something like: 部署后,服务器设置将如下所示:
Nginx --proxy-to--> WSGI Webserver (Spawning) --> WSGI Middleware --> WSGI App (probably MNML or similar)
with the python webserver being managed by supervisord. python webserver由supervisord管理。
What sort of deployment set-up/packages/apps should I be looking into? 我应该研究哪种部署设置/包/应用程序? And is there a specific directory structure I need to stick to with my app to ease deployment?
是否有一个特定的目录结构我需要坚持使用我的应用程序来简化部署?
Your deployment story depends on your app. 您的部署故事取决于您的应用。 Are you using Django?
你在用Django吗? Then the Apache +
mod_wsgi
deployment docs make for a good starting point. 然后Apache +
mod_wsgi
部署文档提供了一个很好的起点。 Then you can google around for more detail, such as this 2-part series using pip
, virtualenv
, git
, and fabric
. 然后你可以谷歌四处寻找更多细节,比如这个由两部分组成的 系列使用
pip
, virtualenv
, git
和fabric
。
Really, fabric
, virtualenv
, and all those other tools are designed to make it easier to maintain and automate your deployment. 实际上,
fabric
, virtualenv
和所有其他工具旨在使维护和自动化部署更容易。 Initially, the steps from the documentation are probably enough. 最初,文档中的步骤可能就足够了。 After you get a feel for how things work, you can revisit to improve your process.
在了解了工作原理后,您可以重新审视以改进流程。
I've heard good things about Fabric : 我听说过关于Fabric的好东西:
Fabric is a Python library and command-line tool designed to streamline deploying applications or performing system administration tasks via the SSH protocol.
Fabric是一个Python库和命令行工具,旨在通过SSH协议简化部署应用程序或执行系统管理任务。 It provides tools for running arbitrary shell commands (either as a normal login user, or via
sudo
), uploading and downloading files, and so forth.它提供了用于运行任意shell命令(作为普通登录用户或通过
sudo
),上载和下载文件等的工具。
You already mentioned buildout, and it's all you need. 你已经提到了buildout,这就是你所需要的。 Google for example buildouts for the different parts.
例如,Google针对不同部分进行了扩建。 Takes a while to set it up the first time, but then you can reuse the setup between different projects too.
需要一段时间才能在第一时间进行设置,但是您也可以在不同项目之间重复使用设置。
Let supervisord start everything, not just the python server. 让supervisord开始一切,而不仅仅是python服务器。 Then start supervisord at reboot either fron cron or init.d.
然后在重新启动时从fron cron或init.d启动supervisord。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.