समाधान का विचार स्पष्ट है:यदि वर्तमान कनेक्शन टूट गया है, तो mysql से पुनः कनेक्ट करें।
कृपया इसे देखें:
def make_sure_mysql_usable():
from django.db import connection, connections
# mysql is lazily connected to in django.
# connection.connection is None means
# you have not connected to mysql before
if connection.connection and not connection.is_usable():
# destroy the default mysql connection
# after this line, when you use ORM methods
# django will reconnect to the default mysql
del connections._connections.default