You are on page 1of 18

Flask 入门

• Python网站开发框架
大纲

• 什么是⽹站开发框架
• MVC开发模式
• Flask入门
Python Ecosystem

Data Analysis & Visualization Web Development


开发框架 Web Framework

• MVC开发模式
• Flask基础介绍
Flask 后端开发
为什么需要范式 WHY MVC ?

”Functionality may be
achieved through the use of
any of a number of possible
structures. In fact, if
functionality were the only
requirement, the system
could exist as a single
monolithic module with no
internal structure at all.”
--
Software Architecture in
Practice
Chapter 4
MVC 范式
Flask 基本法则

• Route, Make a function available to a URL


• Function-Based Methods
• Redirect
• 404
如何给后台传递参数

• URL参数
• HTTP POST Body
• Form
无处不在的二维码QR

• Quick Response

图片来自: https://zh.wikipedia.org/wiki/QR%E7%A2%BC
静态文件管理, Path vs URL/URI
懒人的福音,Template

• Help server know how to render html


认证授权与会话

• Cookie Based
• Token Based
网站日志 logging

• Python Logging
MVC

ROUTES VIEW

CONTROLLER
MODEL
如何链接数据库

• 数据库驱动直接连接
• ORM
Better Framework

• aiohttp
• django
谢谢

beijing@dataapplab.com

You might also like