Skip to Content
Flask Web开发:基于Python的Web应用开发实战(第2版)
book

Flask Web开发:基于Python的Web应用开发实战(第2版)

by Miguel Grinberg
August 2018
Intermediate to advanced
230 pages
6h 42m
Chinese
O'Reilly Media, Inc. Beijing
Content preview from Flask Web开发:基于Python的Web应用开发实战(第2版)
186
17
secure=secure)
mail_handler.setLevel(logging.ERROR)
app.logger.addHandler(mail_handler)
你可能还记得,所有配置类都有一个 init_app() 静态方法,在 create_app() 方法中调用,
但目前还没用到。现在,在 ProductionConfig 类的 init_app() 方法中,我们为应用日志记
录器配置了一个处理程序,把错误通过电子邮件发给指定的收件人。
电子邮件日志记录器的日志等级被设为 logging.ERROR,所以只有发生严重错误时才会发
送电子邮件。通过添加适当的日志处理程序,可以把等级较轻缓的日志消息写入文件、系
统日志或支持的其他目的地。日志的处理方法很大程度上依赖于应用所在的托管平台。
如果你从
GitHub
上克隆了这个应用的
Git
仓库,那么可以执行
git checkout
17b
检出应用的这个版本。
17.3
 云部署
如今流行把应用托管在“云端”,不过这有多层意思。最简单的情况下,云托管的意思是
把应用部署到一台或多台
虚拟服务器
上。虚拟服务器操作起来的感受与物理设备很像,但
却是由云服务公司管理的虚拟设备。
AWS
Amazon Web Services
)提供的
EC2
服务就是
这样的服务器。把应用部署到虚拟服务器上的方法与部署到传统的专用服务器上的方法
(本章后文将讨论)类似。
更高级的部署方法是基于
容器
。一个容器把应用隔离在一个
映像
image
)中,里面包含
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Python机器学习基础教程

Python机器学习基础教程

Andreas C. Müller, Sarah Guido
Python编程入门与实战

Python编程入门与实战

Posts & Telecom Press, Fabrizio Romano
程序设计导论:Python语言实践

程序设计导论:Python语言实践

罗伯特 塞奇威克, 凯文 韦恩, 罗伯特 唐德罗

Publisher Resources

ISBN: 9787115489456