@app.errorhandler(404)
async def page_not_found(e):
return render_template("404.html"), 404
The handler is executed 3 times even if render_template throws an exception and returns 500
On the client, a log was written when the last handler was executed.
page_not_foundand this runs code again and again.404inreturnbecause it may raise again@app.errorhandler(404)- maybe tryreturn render_template("404.html")without, 404