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版)
24
3
{% extends "base.html" %}
{% block title %}Index{% endblock %}
{% block head %}
{{ super() }}
<style>
</style>
{% endblock %}
{% block body %}
<h1>Hello, World!</h1>
{% endblock %}
extends 指令声明这个模板衍生自
base.html
。在 extends 指令之后,基模板中的
3
个区块
被重新定义,模板引擎会将其插入适当的位置。如果基模板和衍生模板中的同名区块中都
有内容,衍生模板中的内容将显示出来。在衍生模板的区块里可以调用 super(),引用基
模板中同名区块里的内容。上例中的 head 区块就是这么做的。
稍后会展示这些控制结构的具体用法,让你了解一下它们的工作原理。
3.2
 使用
Flask-Bootstrap
集成
Bootstrap
Bootstrap
Twitter
开发的一个开源
Web
框架,它提供的用户界面组件可用于创建整洁且
具有吸引力的网页,而且兼容所有现代的桌面和移动平台
Web
浏览器。
Bootstrap
是客户端框架,因此不会直接涉及服务器。服务器需要做的只是提供引用了
Bootstrap
层叠样式表(
CSS
cascading style sheet
)和
JavaScript
文件的
HTML
响应,并在
HTML
CSS
JavaScript
代码中实例化所需的用户界面元素。这些操作最理想的执行场 ...
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