Using CMD, run the following commands to download the flask. Using app.py as our Python file to manage templates, 404. html as the file we'll return in the event of a 404 error, and header. html as the file that contains a website's header and navbar.
Flask allows you to raise any HTTP exception that Werkzeug has registered. The default HTTP exceptions, on the other hand, return plain exception pages. When an error occurs, you might wish to show the user custom error pages. Error handlers can be used to do this.
If I execute the python file from the shell, Python Flask displays detailed errors in the browser. This is a command for inspecting specific mistakes. As a result, I had to disable the WSGI mod in order to run a python file and examine the detailed errors that Flask supported.
In Flask, the 404 Error, also known as an invalid route error, is handled by defining an error handler. def invalid route(e): @app. errorhandler(404): "Invalid route," it says. If you save the modifications and then try to access a route that doesn't exist, you'll get a "Invalid route" notice.
Unless it's a 501 or another code, in which case you'd have to put in every number above 500.
That was a great repair!
Rather of being strident (status).
startswith('5') I'd go with the more straightforward integer comparison: Because there are no bigger error codes, 500 = status 600 (or simply status >= 500).
Learner's Ratings
4.6
Overall Rating
86%
0%
5%
5%
4%
Reviews
PATIL KUNAL SUNILBHAI
5
Fabulous learning experience
A
AMAN KUMAR
5
Very nice teaching.
S
Samiul Basir
5
She is best instructor I've ever learned.
S
Sujit babu
5
GREAT TEACHER ❤❤❤❤❤❤❤😍😍😍😍😘😘😘💕💕💕💕
R
Rajnish Kumar
5
ma'am this session is very well ma'am please prove Django
9
90videos Challenge5
5
Very good teching Thank You mam
A
Aditya Singh
5
Great learning experience, can we get the slides used in the lecture ?
P
prachi jadhav
5
Good platform to learn
E
Er Komal Gupta
5
very nice understandable....thanku mam
A
Ayush Kumar Tatia
5
Mam genuinely thankyou for making it so good , Bhagwaan aapko bhot aage le jaaye , rich log aapke content dekh ke certificate le , i truly wish 😊, mae hi baad mae pay krunge because i be rich futur😊
Share a personalized message with your friends.