当从 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,通道=2.1.6,达芙妮=2.2.4。一旦将 GET 请求发送到 localhost:8000,就会发生这种情况。尝试使用 manage.py runserver 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
})