Flask Web开发

[美]米格尔•格林贝格

出版时间

2018-07-31

ISBN

9787115489456

评分

★★★★★

标签

编程

书籍介绍

本书共分三部分,全面介绍如何基于Python微框架Flask进行Web开发。第一部分是Flask简介,介绍使用Flask框架及扩展开发Web程序的必备基础知识。第二部分则给出一个实例,真正带领大家一步步开发完整的博客和社交应用Flasky,从而将前述知识融会贯通,付诸实践。第三部分介绍了发布应用之前必须考虑的事项,如单元测试策略、性能分析技术、Flask程序的部署方式等。第2版针对Python 3.6全面修订。

AI导读
核心看点
  • 系统介绍Flask微框架基础,涵盖路由、模板、表单等核心知识
  • 通过构建Flasky博客应用,将理论知识融会贯通,付诸实践
  • 深入讲解单元测试、性能分析及部署策略,完善开发全流程
适合谁读
  • 具备Python基础语法,希望快速入门Flask框架的开发者
  • 需要从零开始构建Web应用,寻求完整实战案例的初学者
  • 对Python后端开发感兴趣,想了解微框架设计哲学的技术人员
读前提醒
  • 本书基于Python 3.6修订,部分旧版语法可能需对照新版文档
  • 建议边读边敲代码,避免仅依赖Git仓库代码,强化动手能力
  • 数据库章节逻辑较绕,若遇困难可结合官方文档或社区资源辅助
读者共识
  • 篇幅短小精悍,结构紧凑,是Flask入门学习的极佳选择
  • 实战项目麻雀虽小五脏俱全,能有效帮助读者快速搭建Web
  • 部分环境配置指引略显过时,但整体框架思路依然具有参考价值

本导读基于书籍简介、目录、原文摘录、短评和书评生成,不等同于全文精读。

精彩摘录
  • "To start using the virtual environment, you have to “activate” it. If you are using a bash command line (Linux and Mac OS X users), you can activate the virtual environment with this command:"
  • "When a virtual environment is activated, the location of its Python interpreter is added to the PATH, but this change is not permanent; it affects only your current command session. To remind you that you have activated a virtual environment, the activation command modifies the command prompt to inc"
  • "When you are done working with the virtual environment and want to return to the global Python interpreter, type deactivate at the command prompt."
  • "The name argument that is passed to the Flask application construc‐ tor is a source of confusion among new Flask developers. Flask uses this argument to determine the root path of the application so that it later can find resource files relative to the location of the application."
  • "@app.route(404) def page_not_found(e): return render_template('404.html'),404 @app.route(500) def internal_server_error(e): return render_template('500.html'),500"
  • "PyCharm 2016.1 or 2016.2:Settings,Tools,Terminal, and add""/K <path-to-your-activate.bat>""toShell path and add (mind the quotes). Also add quotes around cmd.exe, resulting in: `"cmd.exe" /k ""C:\mypath\my-venv\Scripts\activate.bat""`"
  • "Web服务器网关接口(Python Web Server Gateway Interface,缩写为WSGI)是为Python语言定义的Web服务器和Web应用程序或框架之间的一种简单而通用的接口。自从WSGI被开发出来以后,许多其它语言中也出现了类似接口。WSGI是作为Web服务器与Web应用程序或应用框架之间的一种低级别的接口,以提升可移植Web应用开发的共同点。WSGI是基于现存的CGI标准而设计的。 WSGI区分为两个部份:一为“服务器”或“网关”,另一为“应用程序”或“应用框架”。在处理一个WSGI请求时,服务器会为应用程序提供环境资讯及一个回呼函数(Callback Functio"
  • "Why is that? The application will work even with __name__, thanks to how resources are looked up. However it will make debugging more painful. Certain extensions can make assumptions based on the import name of your application. For example the Flask-SQLAlchemy extension will look for the code in yo"
作者简介
【作者简介】 米格尔•格林贝格(Miguel Grinberg) 近30年开发经验的软件工程师,以撰写Python项目开发的博客而广为Python开发者所熟知,经常受邀在PyCon等大会上分享开发经验。 【译者简介】 安道 专注于现代计算机技术的自由翻译,译有《流畅的Python》《Python网络编程攻略》《Ruby on Rails教程》等书。
目录
前言  xi
第一部分 Flask简介
第1章 安装  3
1.1 创建应用目录  4
1.2 虚拟环境  4

显示全部
用户评论
太好了,一些地方能解释地详细点就更好了
讲的很细致,结构上可以更顺畅
讲解得很详细,入门佳作
我谢谢作者,Git 一 check 就完事了,自己再看 diff 有种统揽全局的感觉,比外面那些教程不知道高到哪里去了。
毫不拖泥带水,非常流畅
书中的博客项目比较容易上手
薄薄的一本小书,可以很快的用 Flask 搭建起来整体的 Web,主要是非常的轻量级,有些部分还是写的不是很清晰,总体来说还是不错。
书很薄适合快速入门,内容虽少但恰到好处。
非常棒的flask入门书,从具体业务出发,结合各个功能插件,对flask的应用进行系统讲解,关键还给了每个版本的源码。
下载
收藏