werkzeug.routing.BuildError: Could not build url for endpoint ‘xxxxxx‘. Did you mean ‘xxxx.xxxxx‘ in

werkzeug.routing.BuildError: Could not build url for endpoint ‘xxxxxx‘. Did you mean ‘xxxx.xxxxx‘ in,第1张

解决Flask运行报错werkzeug.routing.BuildError werkzeug.routing.BuildError: Could not build url for endpoint ‘xxxxxx’. Did you mean ‘xxxx.xxxxx’ instead?

解决方法如下

到你报错为xxxxx的重定向redirect下,更改为自定的Blueprint.函数名 例如
报错为werkzeug.routing.BuildError: Could not build url for endpoint
‘testfunc’. Did you mean ‘testblue.testfunc’ instead?

testblue = Blueprint(  # 自定蓝图
    "testblue",
    __name__,
    static_folder=os.path.join(root,'static'),
    template_folder=os.path.join(root,'templates')
)

以下会报错

@testblue.rout('/')
def helloword():
	return redirect('testfunc') #这里报的错

@testblue.rout('/test/')
def testfunc():
	return render_template("index.html")

改为

@testblue.rout('/')
def helloword():
	return redirect('testblue.testfunc')  #这里做了更改

@testblue.rout('/test/')
def testfunc():
	return render_template("index.html")

即可

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/722674.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-04-26
下一篇2022-04-26

发表评论

登录后才能评论

评论列表(0条)

    保存