Thursday, June 23, 2011

Returning a 503 response instead of a 500 response

Some of our apps have to talk to databases outside of our control, and their operators don't have the same uptime standards that we do...

What can I do to make Django return a "503 Service Unavailable" instead of a "500 Internal Server Error", when it encounters a DatabaseError or ProgrammingError while trying to access the database? Bonus points if I could make the 503 page say "there was a temporary database communication problem."

I have some ideas of what I *could* modify, but I'd rather incorporate this into a product or setting instead of having to patch the actual django database backend code itself.

====================================
Steven L Smith, Web Developer
Department of Information Technology Services
Nazareth College of Rochester
585-389-2085 | ssmith46@naz.edu | KC2YTC
http://www.naz.edu/pub/~ssmith46
====================================

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment