@(Flask Web Development 12th chapter)
描述
Flask开发中遇到BuildError: Could not build url for endpoint 'main.followers' with values ['username']. Did you mean 'main.user' instead?
大意:端点main.followers与username无法建立链接
原因:未建立main.followers路由
解决方案
在main/view.py中新建视图函数,代码如下:
@main.route("/follow/<username>")
@login_required
@permission_required(Permission.FOLLOW)
def follow(username):
user = User.query.filter_by(username=username).first()