Gunicorn超时错误,我无法增加它

发布于 2025-01-10 12:34:06 字数 638 浏览 3 评论 0原文

我在 Digital Ocean 上部署了一个 Flask 应用程序,当我执行大型请求时,日志错误是:

[1] [CRITICAL] WORKER TIMEOUT (pid:48)

我尝试增加 Gunicorn 上的超时这样,但错误仍然存​​在:

#gunicorn_config.py

bind = "0.0.0.0:5000"
workers = 2
timeout = 600

#Procfile

web: Gunicorn app:app --timeout 600

#env/Lib/site-packages/gunicorn/coonfig.py

class Timeout(Setting):
    name = "timeout"
    section = "Worker Processes"
    cli = ["-t", "--timeout"]
    meta = "INT"
    validator = validate_pos_int
    type = int
    default = 600
    desc = """\

知道我做错了什么吗?谢谢!

I have a flask app deployed on Digital Ocean,and the log error when i do a large request is:

[1] [CRITICAL] WORKER TIMEOUT (pid:48)

I tried to increment the timeout on Gunicorn this ways but the error persists:

#gunicorn_config.py

bind = "0.0.0.0:5000"
workers = 2
timeout = 600

#Procfile

web: gunicorn app:app --timeout 600

#env/Lib/site-packages/gunicorn/coonfig.py

class Timeout(Setting):
    name = "timeout"
    section = "Worker Processes"
    cli = ["-t", "--timeout"]
    meta = "INT"
    validator = validate_pos_int
    type = int
    default = 600
    desc = """\

Any idea what im doing wrong? Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怎樣才叫好 2025-01-17 12:34:06

尝试指向您的配置文件

gunicorn -c gunicorn_config.py --bind 0.0.0.0:5000 wsgi:app

,请注意,要使此语句起作用,您还需要 wsgi.py 位于同一目录中,并具有以下

from myproject import app

if __name__ == "__main__":
    app.run()

内容 干杯!

try to point to your configuration file

gunicorn -c gunicorn_config.py --bind 0.0.0.0:5000 wsgi:app

note that for this statement to work you need wsgi.py also in the same directory having the following

from myproject import app

if __name__ == "__main__":
    app.run()

Cheers!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文