1

我正在尝试使用频道建立一个 django 实例。我已经成功部署在一个开发环境中,我可以使用 django runserver 将数据服务到本地主机。在我的 prod 环境中,我使用 apache 作为启用了 mod_proxy_wstunnel 的 proxypass 服务器。服务器启动正常,但是当我在浏览器中打开时,在 runserver 控制台中出现以下错误:

2016-06-13 17:20:16,078 - ERROR - http_protocol - Traceback (most recent call last):
  File "/opt/anaconda2/lib/python2.7/site-packages/daphne/http_protocol.py", line 108, in process
    logger.debug("Upgraded connection %s to WebSocket %s", self.reply_channel, protocol.reply_channel)
AttributeError: 'WebSocketProtocol' object has no attribute 'reply_channel'
Unhandled Error
Traceback (most recent call last):
  File "/opt/anaconda2/lib/python2.7/site-packages/twisted/python/log.py", line 101, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "/opt/anaconda2/lib/python2.7/site-packages/twisted/python/log.py", line 84, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "/opt/anaconda2/lib/python2.7/site-packages/twisted/python/context.py", line 118, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/opt/anaconda2/lib/python2.7/site-packages/twisted/python/context.py", line 81, in callWithContext
    return func(*args,**kw)
--- <exception caught here> ---
  File "/opt/anaconda2/lib/python2.7/site-packages/twisted/internet/posixbase.py", line 597, in _doReadOrWrite
    why = selectable.doRead()
  File "/opt/anaconda2/lib/python2.7/site-packages/twisted/internet/tcp.py", line 209, in doRead
    return self._dataReceived(data)
  File "/opt/anaconda2/lib/python2.7/site-packages/twisted/internet/tcp.py", line 215, in _dataReceived
    rval = self.protocol.dataReceived(data)
  File "/opt/anaconda2/lib/python2.7/site-packages/twisted/protocols/basic.py", line 571, in dataReceived
    why = self.lineReceived(line)
  File "/opt/anaconda2/lib/python2.7/site-packages/twisted/web/http.py", line 1692, in lineReceived
    self.allContentReceived()
  File "/opt/anaconda2/lib/python2.7/site-packages/twisted/web/http.py", line 1781, in allContentReceived
    req.requestReceived(command, path, version)
  File "/opt/anaconda2/lib/python2.7/site-packages/twisted/web/http.py", line 768, in requestReceived
    self.process()
  File "/opt/anaconda2/lib/python2.7/site-packages/daphne/http_protocol.py", line 143, in process
    self.basic_error(500, b"Internal Server Error", "HTTP processing error")
  File "/opt/anaconda2/lib/python2.7/site-packages/daphne/http_protocol.py", line 246, in basic_error
    }).encode("utf8"),
  File "/opt/anaconda2/lib/python2.7/site-packages/daphne/http_protocol.py", line 206, in serverResponse
    http.Request.write(self, message['content'])
  File "/opt/anaconda2/lib/python2.7/site-packages/twisted/web/http.py", line 951, in write
    self.transport.writeSequence(l)
exceptions.AttributeError: 'NoneType' object has no attribute 'writeSequence'

我相关的 apache 配置是这样的:

RewriteEngine On
DocumentRoot /var/www/html/django-ui
ProxyPass /static/ !
Alias /static/ /var/www/html/django-ui/cyberSA/static/
  <Location "/">
    ProxyPass "ws://localhost:8000/"
  </Location>

我试图在 http_protocol 文件中隔离问题,它似乎与协议对象有关。我在这里想念什么?

4

0 回答 0