Avoiding “MySQL server has gone away” on infrequently used Python / Flask server with SQLAlchemy

后端 未结 7 898
别跟我提以往
别跟我提以往 2020-12-07 11:15

How can Flask / SQLAlchemy be configured to create a new database connection if one is not present?

I have an infrequently visited Python / Flask server which uses S

7条回答
  •  旧巷少年郎
    2020-12-07 11:32

    IF you are using Flask-SQLAlchemy:

    Seems like a fix is available: https://github.com/mitsuhiko/flask-sqlalchemy/issues/2

    Sadly, the default installation (pip install flask-sqlalchemy) doesn't apply the patch properly yet, especially on this issue: https://github.com/e-dard/flask-sqlalchemy/commit/cf659f346e005d34257d256fa4c42889741fc31f

    Getting the latest version from github should fix it.

提交回复
热议问题