Exceptional HTTP status codes in Django

This article was published by James Aylett on Sunday, February 07, 2010 at 17:39.

Django has support for emitting a response with any HTTP status code. However some of these are exceptional conditions, so the natural Pythonic way of generating them would be by throwing a suitable exception.

This required some Django plumbing, which Richard Boulton put together and I turned into a Django app on github. I explain it in some detail.