6/3/2023 0 Comments Flask 404 not found![]() ![]() Ideally, we would like to avoid writing any Python code at all for each individual error handler. Which is, of course, why we’d want to deal with all in a little smarter way and with less boilerplate. Pick a corresponding template and simply render it. You’ll notice they get pretty repetitive: for each erroneous HTTP status code (404, 403, 400, etc.), If you have more handlers like that, though, Request error than to send back some HTML with an appropriate message. There’s rarely anything else to do in response to serious ( 404 ) def not_found ( error ): return render_template ( 'errors/404.html' )Īlbeit simple, the above example is actually very realistic.
0 Comments
Leave a Reply. |