Gunicorn NameError:未定义全局名称'fileno'

时间:2016-01-04 21:31:12

标签: django gunicorn

我现在正在使用带有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'

1 个答案:

答案 0 :(得分:4)

我与Flask应用程序存在完全相同的问题。原来这是Gunicorn 19.4.4中的一个错误。降级到19.4.3解决了我的问题。

向上游报告。