【问题标题】:How can I increase gunicorn --limit-request-line in a python App Engine application with Flask?如何使用 Flask 在 python App Engine 应用程序中增加 gunicorn --limit-request-line?
【发布时间】:2020-10-05 19:55:25
【问题描述】:

这是一个排序问题,我正在 Google Cloud Platform 中使用 python 运行时和 Flask 构建一个非常简单的 API。问题是请求 URL 可能会有点长(大约 6000 字节)并且当前的 gunicorn 限制是 4096。我知道这听起来很愚蠢,但我试图在 app.yaml 文件上更改它,当我运行它时返回 500 服务器错误。我几乎可以肯定这是我添加的入口点中的一个问题,因为我不知道如何修改 app.yaml(我是 Web 开发的新手)。我的 app.yaml 如下:

runtime: python37
service: py
entrypoint: gunicorn --limit-request-line 8190 main:app

如果你知道我有什么错误,有人可以帮助我吗?我检查了 GCP 文档和演示,但像往常一样,它们的描述性不是很好。

【问题讨论】:

    标签: python google-app-engine flask gunicorn


    【解决方案1】:

    如果您还没有 gunicorn,您可能需要在 requirements.txt 中添加它,正如 docs 提到的那样。

    关于app.yaml 中的入口点,它看起来是正确的,但是我认为您缺少添加端口以让 App Engine 监听 8080,这是一项要求。

    entrypoint: gunicorn -b :8080 --limit-request-line 8190 main:app

    更多信息也可以在以下section of the documentation中找到。

    【讨论】:

    • 你是救世主!我在 requirements.txt 和端口中添加了 gunicorn。再次非常感谢!
    • 没问题,乐于助人! PS:请考虑将答案标记为正确,以便社区的其他成员可以从中受益:)
    猜你喜欢
    • 2020-06-09
    • 1970-01-01
    • 1970-01-01
    • 2020-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-22
    相关资源
    最近更新 更多