Иван Сушков Иван Сушков - 6 months ago 57
Python Question

How to change error page in Flask?

I have a method, that allowed only post

. When i send send
request, i get a standard error page.

Can i change it or make redirect for another page?


You can use the errorhandler decorator to provide custom handling of a 405 error.

from flask import render_template

def page_not_found(e):
    return render_template('405.html'), 405