首页 > 其他 > 详细

Flask的路由及视图函数

时间:2021-04-25 10:22:05      阅读:13      评论:0      收藏:0      [点我收藏+]

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.

Flask的路由及视图函数

原文:https://www.cnblogs.com/zhx-95-/p/14698602.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!