flask的路由系统1234567891011121314151617181920212223flask中最经典的设置路由的方式是通过装饰器@app.route('/')#route的参数1.rule 路径 #这个必须要填2.options methods #允许进入的请求方式,例如GET,POST endpoint #别名,用于做反向解析,不写,默认是函数名 default #给函数传递的参数 redirect_to #重定向的地址 strict_slashes = None #对URL最后的 / 符号是否严格要求 #转换器我们还可以使用在路由中使用转换器eg: @app.route('/detail/<int:nid>',methods=['GET'],endpoint='detail')flask我们还可以设置另外一种路由方式#FBV式的app.add_url_rule('/',endpoint='index',view_func=index)#CBV式的app.add_url_rule('/',endpoint='index',view_func=index.as_view(name='index')) #as_view中的name必填