I have deployed a flask app with postgresql database. Everything works perfectly when I deploy the app, but after some times it does not work. Upon checking the logs it shows
Our Postgres apps have a 30 min timeout on connections. If your app isn’t doing anything for 30 minutes, the connection will close.
I haven’t used Python with Postgres, but most decent Postgres drivers have options that let you either ping a database with a command periodically, or reconnect when the connection drops.