flask小结

http通讯过程

https://www.cnblogs.com/andy9468/p/10871079.html

1、flask开发环境

https://www.cnblogs.com/andy9468/p/10870496.html

2、简单的flask对象

https://www.cnblogs.com/andy9468/p/10870516.html

3、flask的配置项和读取配置项

修改/新增配置项有3种方法,读取配置有两种方法

https://www.cnblogs.com/andy9468/p/10870574.html

4、查看flask中所有的路由信息(同时查看允许的请求方式get、post)

print(app.url_map)

https://www.cnblogs.com/andy9468/p/10871403.html

同一个url对应多个视图函数,取第一个视图函数有效

同一个url设置不同的请求方式

https://www.cnblogs.com/andy9468/p/10871453.html

多个url对应同一个视图函数

https://www.cnblogs.com/andy9468/p/10871491.html

flask中重定向所涉及的反推:由视图函数反推url

https://www.cnblogs.com/andy9468/p/10871539.html

5、flask转换器(用于做动态路由)

(1)通过正则,提取url中数据的工具,成为flask转换器。

flask自有转换器:int、float、path(和默认string相似,但接受斜线) 3种类型,默认为string不包括斜线/的字符串类型。

https://www.cnblogs.com/andy9468/p/10871769.html

(2)自定义flask转换器:

1)定义自己的转换器

2)将自定义的转换器添加到flask的应用中

3)使用

https://www.cnblogs.com/andy9468/p/10871828.html

(3)使用url_for()时,会自动调用转换器的to_url()方法

https://www.cnblogs.com/andy9468/p/10871937.html

原文地址:https://www.cnblogs.com/andy9468/p/10870592.html