How to simulate a broken database connection for testing in Django
I spent a very long amount of time trying to figure out how to simulate a broken database connection in Django. The problem is that not only do you want raw cursors to timeout, but also all models accessing the database.
Source: How to simulate a broken database connection for testing in Django, an article by Neil Kakkar.