Daphne在将Django从1.11升级到2.0时出现问题

2024-10-16 20:42:34 发布

您现在位置:Python中文网/ 问答频道 /正文

从django 1.11升级到2.0时,会发生以下情况:

Traceback (most recent call last):
  File "/home/.local/share/virtualenvs/django2/lib/python3.6/site-packages/daphne/http_protocol.py", line 179, in process
    "server": self.server_addr,
TypeError: object() takes no parameters

Django版本2.0.10,channels=2.1.6,daphne=2.2.4。一旦GET请求发送到本地主机:8000。 试用管理.py运行服务器0.0.0.0:8000。你知道吗

违规线路:

self.application_queue = self.server.create_application(self, {
                "type": "http",
                # TODO: Correctly say if it's 1.1 or 1.0
                "http_version": self.clientproto.split(b"/")[-1].decode("ascii"),
                "method": self.method.decode("ascii"),
                "path": unquote(self.path.decode("ascii")),
                "root_path": self.root_path,
                "scheme": "https" if self.isSecure() else "http",
                "query_string": self.query_string,
                "headers": self.clean_headers,
                "client": self.client_addr,
                "server": self.server_addr,  # <<<<<<<<< OFFENDING LINE
            })

Tags: pathpyselfhttpstringifserverapplication