MySQL is automatically restored in django

How do you determine the behavior of MySQL auto-reconnect in django ?
I assume this is a client-side configuration, right?

+7
source share
1 answer

Django database shells have an is_usable() method that checks the server for viruses. This is for MySQL -

 def is_usable(self): try: self.connection.ping() except DatabaseError: return False else: return True 

From the MySQL URL you provided -

If auto-connect is enabled, mysql_ping () reconnects. Otherwise, it returns an error.

So it all depends on how you configured this part -

 mysql_options(&mysql, MYSQL_OPT_RECONNECT, &reconnect); 

which you must install in the DBMS.

+1
source

All Articles