Forums

How can i keep a mysql connection alive after the 5 minutes timeout time of pythonanywhere? (I mean a sort of persistent connection that does not timeout)

Hi, I have been working on pythonanywhere for a while and now i'm facing this problem. My mysql connection times out after 5 minutes and i found out it is the timeout time imposed by pythonanywhere. It is strange because it didnt use to happen till some days ago. Anyway I am looking for a way to keep my mysql connection alive for a much longer time than 5 minutes, otherwise I would have to reconnect many many times to mysql and (i think) it would be quite inefficient. Thanks to whoever will answer

It's a general setting for all users and we can't change it per user. We'd rather suggest to close the connections and have a connection per query.