flask: AttributeError: 'function' object has no attribute 'route'

 

@detail.route('/detail')
def detail():
    return render('detail/index.html')

 

如上代码:路由装饰器为detail, 函数名也是 detail 。所以会有这个错

解决办法: 函数名与路由装饰器冲突,修改装饰器名或者修改函数名

posted @ 2020-06-11 15:27  frange  阅读(802)  评论(0编辑  收藏  举报