vendredi 31 juillet 2015

Best practice to keep connection to mysql/mariadb from Python webapp

I init mariadb connection while webapp initialization like this:

con = MySQLdb.connect('localhost', 'user', 'pass', 'db')

Now I've found it doesn't work since there is a timeout to this connection. What is the best practice to set/keep connection to db? Increase timeout, create connection in each request or something more tuned?

Aucun commentaire:

Enregistrer un commentaire