Grokking Django
Vote

0% completed

​

Handling Errors and Exceptions in Django

A view that runs Article.objects.get(id=999) for an article that does not exist does not stop the server. The get() call raises Article.DoesNotExist, the view does not catch it, and Django catches it instead. With DEBUG = False, the visitor receives a page with status 500, "Server Error", and the server continues with the next request. Django turns every exception that leaves a view into an HTTP response. The work of error handling is to make sure each problem becomes the right response, with a useful page for the visitor and a useful record for you.

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content