有两种注册路由方式,一种是用装饰器,一种是直接用add_url_rule()函数,装饰器其实是把add_url_rule()进行了封装。 # 方式一 @app.route('/hello') def hello(): return "Hello World" # 方式二 app.add_url_rule('/hello', view_func= hello) 装饰器 廖雪峰的官方网站 刘江的博客 路由 什么是前端路由