django.core.wsgi and mysql db connection (2006,'MYSQL server has gone away')

时间:2017-08-14 07:07:20

标签: python mysql django

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?

0 个答案:

没有答案