简体   繁体   English

PyhtonAnywhere在Flask应用程序中超过了最大用户连接数

[英]PyhtonAnywhere Exceeded Max User Connections in Flask app

I have a Python Flask web site running in PythonAnywhere. 我有一个在PythonAnywhere中运行的Python Flask网站。 It runs fine for some time and then I start getting "User 'felipeavl' has exceeded the 'max_user_connections' resource (current value: 3) " 它运行了一段时间,然后开始出现“用户'felipeavl'已超出'max_user_connections'资源(当前值:3)”

I am using SQLAlchemy and setting pool_recycle as advised in PythonAnywhere forums : 我正在使用SQLAlchemy并按照PythonAnywhere论坛中的建议设置pool_recycle:

engine = create_engine(SQLALCHEMY_DATABASE_URI, pool_recycle=280)

I am also closing the session in all my flask methods, although SQlAlchemy was supposed to manage the connections, if I am not wrong: 我也用我所有的flask方法关闭了会话,尽管我没有记错,但应该由SQlAlchemy管理连接:

def listarEmissores():
    session = DBSession()
    emissores = session.query(Emissor).all()
    session.close()
    return render_template('listar_emissores.html', emissores=emissores);

In my local MySql database everything runs fine. 在我的本地MySql数据库中,一切正常。 Am I missing any other configurations ? 我是否还缺少其他配置?

You may have to email support at Pythonanywhere to get them to reset the connections on their end (as I had to). 您可能必须通过Pythonanywhere通过电子邮件发送支持,以使他们重新设置其连接(如我所必须)。 Otherwise, you will see I had the same issue (and my solution) at the bottom of the following page: How do I fix this Gets server error, which is causing display issues? 否则,您将在下一页的底部看到我遇到相同的问题(以及解决方案): 如何解决此Gets服务器错误,这会导致显示问题?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM