Flask_view学习

Flask Views

路由

  • 路由的获取
  • <>
    • 语法: converter:name
    • converter
      • int
      • float
      • string
        /作为结尾
      • path
        从path修饰开始,以后的定西都使我们的
      • uuid
      • any
        穷举路由

视图函数

  • 默认支持GET、HEAD、OPTIONS
  • 其余请求不支持
  • 想支持某种请求需要手动添加
    • methods=["GET","POST"]
  • url_for
    反向解析,根据函数名字,获取反向路径
    • url_for('函数名',参数名=value)

FLask 四大内置对象

Request

  • request

Session

  • session

G

  • g

config

  • 在模板中 conflg
  • 在Python代码中 app.config
posted @ 2020-04-03 17:14  YNZero  阅读(257)  评论(0)    收藏  举报