I wrote a simple flask web app that uses flask + mysql from Python anywhere. I initially just wrote an app.py which seemed to run fine (in terms of connection to mysql and queries). Later I switched to app factory pattern and it was largely the same code. Once I reload webapp, it works fine in terms of connections. After 5 to 10 minutes, I just get errors for any view that uses SQL queries and it fails to connect to database properly. Anyone else faced similar issues? Am I missing something dumb when I do this?