如下图所示,两种函数均可创建路由:
一:
1:、 app.route的底层就是用 add_url_rule来实现的
2、 app.route 不能单独使用,而add_url_rule 可以单独使用
二:
add_url_rule 的注意事项:
add_url_rule有三个部分 (path,endpoint,view_func)
其中 只有path和 view_func 是 必填参数
endpoint 没有设置,url_for中就写函数的名字,如果设置了,就写endpoint的值