记一次 gunicorn 启动 flask 出问题的经历
出错现象: gunicorn+nginx+flask 部署项目, 部署过程没问题,项目也正常启动了,但是一旦访问接口,就会报错: Traceback (most recent call last): File " /usr/local/lib/python3.6/dist-packages/gunicorn/workers/sync.py " , line 135, in handle self.handle_request(listener, req, client, addr) File " /usr/local/lib/python3.6/dist-packages/gunicorn/workers/sync.py " , line 176, in handle_request respiter = self.wsgi(environ, resp.start_response) TypeError: __call__ () takes from 1 to 2 positional arguments but 3 were given 但是我通过 runserver运行的话,是没有问题的,外网可以正常访问. 所以问题就出在gunicorn 和 flask 的 wsgi 对接上. gunicorn 启动时的方式是 gunicorn [options] file:app