I have written a server script in python to connect to Mysql database using get_wsgi_application in django.core.wsgi.
But the server often gets idle for long hours and after that I get an error(2006,'MYSQL server has gone away'), when server tries to query the database.
One possible solution could be increasing the value of wait_timeout in Mysql server, but then this would keep others connections alive for long intervals as well.
Is there any other way to resolve this issue or a way to re-establish the Mysql connection after it goes down?