Unable to catch the python exception?
First, use a catch all exception and see what exception it throws. The class and module will hint at where you may import the exception to catch from.
try: thing_that_raises_exception() except Exception as e: print(e.__class__) print(e.__module__)
keywords: Django, MySQL, except ProgrammingError, django.db.utils.ProgrammingError