小编Ben*_*ang的帖子

使用 Gunicorn 运行 Flask 得到“错误处理请求 [计数必须是正整数(得到 0)]”

版本:Python 3.8.2 Flask 2.0.1 Werkzeug 2.0.1 Gunicorn 20.1.0

在python3.7或3.8中运行flask,gunicorn模式是'sync'或'gevent/eventlet',我在终端中得到相同的错误:“count必须是正整数(得到0)”,但浏览器中的网站似乎没有异常,chrome控制台也没有报错。

古尼康配置:

# gunicorn.conf.py
workers = 5
worker_class = "sync"  # or "gevent"
bind = "0.0.0.0:8080"
Run Code Online (Sandbox Code Playgroud)

输出:

>>> gunicorn application:app -c ./gunicorn.conf.py

Starting gunicorn 20.1.0
Listening at: http://0.0.0.0:8080 (69063)
Using worker: sync   # or "gevent"
Booting worker with pid: 69065
Booting worker with pid: 69066
Booting worker with pid: 69067
Booting worker with pid: 69068
Booting worker with pid: 69069
[69065] [ERROR] Error handling request
Traceback (most recent call last):
  File "/Users/xxx/.virtualenvs/yyy/lib/python3.8/site-packages/gunicorn/workers/sync.py", …
Run Code Online (Sandbox Code Playgroud)

python flask gunicorn

10
推荐指数
2
解决办法
4854
查看次数

标签 统计

flask ×1

gunicorn ×1

python ×1