Django: how to properly handle a database connection error
You could use a middleware with a process_view method and a try / except wrapping your call. 
Or you could decorate your views and wrap the call there.
Or you could use class based views with a base class that has a method decorator on its dispatch method, or an overriden.dispatch.
Really, you have plenty of solutions.
Now, as said above, you might want to modify your Desktop application too!
I have a desktop application that send POST requests to a server where a django app store the results. DB server and web server are not on the same machine and it happens that sometimes the connectivity is lost for a very short time but results in a connection error on some requests:

OperationalError: (2003, "Can't connect to MySQL server on 'xxx.xxx.xxx.xxx' (110)")

On a "normal" website I guess you'd not worry too much: the browser display a 500 error page and the visitor tries again later. 
In my case loosing info posted by a request is not an option and I am wondering how to handle this? I'd try to catch on this exception, wait for the connectivity to come back (lag is not a problem) and then continue the process. But as the exception can occur about anywhere in the code I'm a bit stuck on how to proceed.
Thanks for your advice.