Ping MySQL to keep connection alive in Django
Setup a connection pool or manually connect the worker as suggested by @ProblemFactory
http://dev.mysql.com/doc/refman/5.6/en/connector-python-connection-pooling.html
connection.connection.ping() will work only with Oracle and MySQL, do not use it.
Right solution is:
from django.db import connection # works with default connection only, use 'connections'
if connection.is_usable():
print("ok")
else:
print("error")