Flask的路由及视图函数

1、路由:

  @app.route("/", methods = ("GET","POST"))

 

2、视图函数

  @app.route(:"/",methods = ("GET","POST"))

  def  index():

          return  "123"

 

3、返回值:

   1. Response  "test"

   2. from flask import render_template

       render_template  return  render_template("index.html")    #默认情况下模板存放在  templates

   3. from flask  import  redirect

     return  redirect("/login")

  4.  from flask  import   send_file

      return  send_file(file_name)

 

5.

相关文章

Jinja2:是Python的Web项目中被广泛应用的模板引擎,是由Pyt...
监听QQ消息并不需要我们写代码,因为市面上已经有很多开源QQ...
【Flask框架】—— 视图和URL总结
python+web+flask轻量级框架的实战小项目。登录功能,后续功...
有了这个就可以配置可信IP,关键是不需要企业认证,个人信息...