python - 如何使用 Flask 在 python App Engine 应用程序中增加 gunicorn --limit-request-line?
问题描述
这是一个排序问题,我正在 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 文档和演示,但像往常一样,它们的描述性不是很好。
解决方案
You may need to have gunicorn in your requirements.txt
if you don't have it already, as the docs mention.
Regarding the entrypoint in your app.yaml
it looks correct, however I think you're missing adding the port to have App Engine listening to 8080, which is a requirement.
entrypoint: gunicorn -b :8080 --limit-request-line 8190 main:app
More information can be found as well in the following section of the documentation.
推荐阅读
- javascript - 为什么检查的伪类在 css 中不起作用?
- java - 将霍夫曼编码的字符串写入Java文件时如何处理奇数字节?
- python - 测试列表中所有可能性的程序
- javascript - 如何在不知道调用者函数的情况下拦截 javascript 中的 api 调用?
- java - 将依赖项复制到 gradle 中的 libs 文件夹
- linux - Sublime Text:[Errno 2] 没有这样的文件或目录:'gopls'
- html - 将所有输入、标签和选择元素居中
- amazon-dynamodb - aws dynamodb 查询包含特殊字符的属性值?
- laravel - Laravel Postgres SQLSTATE [42601]:语法错误:7 错误:“”“”处或附近的零长度分隔标识符
- c++ - 即使所有数组都被删除 C++,内存仍然泄漏