7. Deployment

部署 Deployment

部署包括了把你的web应用打包安装到生产环境并让它跑起来。

为什么部署是必须?

你的web应用要放到生产环境,而不是你的台式机或笔记本里。

部署图

Python web应用部署有许多步骤需要处理。下图显示了每一步与其余步骤如何联系。

Full Stack Python site map.

选择部署的主机

主机的选项一般有4种:

  1. “Bare metal” servers
  2. Virtualized servers
  3. Infrastructure-as-a-service
  4. Platform-as-a-service

前3种比较类似。部署人员需要找一个Linux发行版本,安装数据库,Python环境。最后把应用安装到主机。environment.

部署资源

  • If you need a step-by-step guide to deploying a Python web application, I wrote a whole book on exactly this topic called The Full Stack Python Guide to Deployments that you’ll find super helpful.
  • Deploying Python web applications is an episode of the great Talk Python to Me podcast series where I discuss deploying web applications based on a fairly traditional virtual private server, Nginx and Green Unicorn stack.
  • Thoughts on web application deployment walks through stages of deployment with source control, planning, continuous deployment and monitoring the results.
  • Deploying Software is a long must-read for understanding how to deploy software properly.
  • Practical continuous deployment defines delivery versus deployment and walks through a continuous deployment workflow.
  • In this free video by Neal Ford, he talks about engineering practices for continuous delivery. He explains the difference between continuous integration, continuous deployment and continuous delivery. Highly recommended for an overview of deployment concepts and as an introduction to the other videos on those subjects in that series.
  • Continuous deployment at Instagram is the story of how their deployment process evolved over time from a large Fabric script to continuous deployments. Along the way they encountered issues with code reviews, test failures, canary builds and rollbacks. It’s a great read that sheds some light on how Python deployments can be done well at large scale.
  • Stack Overflow’s guide on how they do deployment is an awesome in-depth read covering topics ranging from git branching to database migrations.
  • If you’re using Flask this detailed post on deploying it to Ubuntu is a great way to familiarize yourself with the deployment process.

部署学习清单

  1. If you’re tight on time look at the platform-as-a-service (PaaS) options. You can deploy a low traffic project web app for free or low cost. You won’t have to worry about setting up the operating system and web server compared to going the traditional server route. In theory you should be able to get your application live on the web sooner with PaaS hosting.
  2. Traditional server options are your best bet for learning how the entire Python web stack works. You’ll often save money with a virtual private server instead of a platform-as-a-service as you scale up.
  3. Read about servers, operating systems, web servers and WSGI servers to get a broad picture of what components need to be set up to run a Python web application.

发表评论

电子邮件地址不会被公开。 必填项已用*标注