Flask giving an internal server error instead of rendering 404 Flask giving an internal server error instead of rendering 404 flask flask

Flask giving an internal server error instead of rendering 404


Internal Server Error is HTTP error 500 rather than 404 and you haven't added error handler for it. This occurs when the server is unable to fulfill the client request properly. To add a gracious message when such error occurred, you can add a errorhandler like 404.

@app.errorhandler(500)def exception_handler(e):    return render_template('500.html'), 500


This will also occur if you have debug set to true. Try setting debug to false and see if your custom 404 shows up then.


There is likely an issue while rendering the 404 template which then triggers an internal server error.

I suggest checking the logs for your app.