Gunicorn NameError: global name 'fileno' is not defined

Gunicorn NameError: global name 'fileno' is not defined

我现在正在使用 gunicorn 开发 Django 应用程序。在过去的几个月里一切正常,但今天,当我尝试将我的最新更改部署到我的开发服务器时,我在尝试访问它时遇到了这个错误:

Traceback (most recent call last):
  File "/Users/ctaylor/.virtualenvs/seniordating/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 130, in handle
    self.handle_request(listener, req, client, addr)
  File "/Users/ctaylor/.virtualenvs/seniordating/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 174, in handle_request
    resp.write_file(respiter)
  File "/Users/ctaylor/.virtualenvs/seniordating/lib/python2.7/site-packages/gunicorn/http/wsgi.py", line 396, in write_file
    if not self.sendfile(respiter):
  File "/Users/ctaylor/.virtualenvs/seniordating/lib/python2.7/site-packages/gunicorn/http/wsgi.py", line 360, in sendfile
    offset = os.lseek(fileno, 0, os.SEEK_CUR)
NameError: global name 'fileno' is not defined

Gunicorn 命令:

gunicorn --bind 0.0.0.0:8000 --pythonpath server base.wsgi_django:application

我一直无法在网上找到关于此的任何信息,并且完全不知道我做了什么导致了这个错误。如果有人有什么想法,请告诉我!

更新

当 运行 我的服务器处于调试模式时,我得到了这个错误,而且它出现了很多次:

Traceback (most recent call last):
  File "/Users/ctaylor/.virtualenvs/seniordating/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/ctaylor/.virtualenvs/seniordating/lib/python2.7/site-packages/django/views/static.py", line 54, in serve
    fullpath = os.path.join(document_root, newpath)
  File "/Users/ctaylor/.virtualenvs/seniordating/lib/python2.7/posixpath.py", line 77, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'

我在使用 Flask 应用程序时遇到了完全相同的问题。结果证明这是 Gunicorn 19.4.4 中的一个错误。降级到 19.4.3 解决了我的问题。

向上游报告。