【发布时间】:2022-11-12 14:49:35
【问题描述】:
使用烧瓶,我试图通过使用 send_from_directory 函数单击 UI 中的按钮向用户发送文件。它曾经工作得很好。我想更改存储库,并且自从更改它以来,我无法再下载该文件。在查看主管日志时,我看到:
[9617] [ERROR] Error handling request
Traceback (most recent call last):
File "path_to_file/venv/lib/python3.4/site-packages/gunicorn/workers/sync.py", line 182, in handle_request
resp.write_file(respiter)
File "path_to_file/venv/lib/python3.4/site-packages/gunicorn/http/wsgi.py", line 385, in write_file
if not self.sendfile(respiter):
File "path_to_file/venv/lib/python3.4/site-packages/gunicorn/http/wsgi.py", line 375, in sendfile
self.sock.sendfile(respiter.filelike, count=nbytes)
AttributeError: 'socket' object has no attribute 'sendfile'
在同一个回购协议中,这在本地工作正常。但是当尝试使用 gunicorn + supervisor + nginx 设置在远程服务器中时,我收到了上述错误消息。我确实在应用程序日志文件中收到 200 Ok 响应。花了很多时间试图修复但没有成功。
此外,以前的 repo 和非工作的当前 repo 之间的工作应用程序之间的显着区别是 python 版本。上一个:python2.7,当前:python3.4
【问题讨论】:
标签: python nginx flask supervisord