我只用一个URL就遇到了一个问题,该URL提供了被同伴拒绝的连接。我在服务器中部署了一个Django项目。以前它可以正常工作,但现在却给了我这个错误,在网页上,它显示为空白屏幕。我从视图发送了正确的响应并能够以文本形式显示,但是它没有使用Django模板特殊功能进行渲染。我尝试了许多在堆栈溢出和许多其他网站上可用的方法,但是什么也没有用。我也尝试重新安装Django,并尝试更改URL并重新启动服务器很多次,但是没有用。我使用的是Amazon-ec2 centos服务器,Django版本2.1,python版本是3.7.3。
Traceback (most recent call last):
File "/usr/lib64/python3.7/wsgiref/handlers.py", line 138, in run
self.finish_response()
File "/usr/lib64/python3.7/wsgiref/handlers.py", line 180, in finish_response
self.write(data)
File "/usr/lib64/python3.7/wsgiref/handlers.py", line 279, in write
self._write(data)
File "/usr/lib64/python3.7/wsgiref/handlers.py", line 453, in _write
result = self.stdout.write(data)
File "/usr/lib64/python3.7/socketserver.py", line 799, in write
self._sock.sendall(b)
ConnectionResetError: [Errno 104] Connection reset by peer
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 60208)
Traceback (most recent call last):
File "/usr/lib64/python3.7/wsgiref/handlers.py", line 138, in run
self.finish_response()
File "/usr/lib64/python3.7/wsgiref/handlers.py", line 180, in finish_response
self.write(data)
File "/usr/lib64/python3.7/wsgiref/handlers.py", line 279, in write
self._write(data)
File "/usr/lib64/python3.7/wsgiref/handlers.py", line 453, in _write
result = self.stdout.write(data)
File "/usr/lib64/python3.7/socketserver.py", line 799, in write
self._sock.sendall(b)
ConnectionResetError: [Errno 104] Connection reset by peer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib64/python3.7/wsgiref/handlers.py", line 141, in run
self.handle_error()
File "/home/ec2-user/venv/lib/python3.7/site-packages/django/core/servers/basehttp.py", line 86, in handle_error
super().handle_error()
File "/usr/lib64/python3.7/wsgiref/handlers.py", line 368, in handle_error
self.finish_response()
File "/usr/lib64/python3.7/wsgiref/handlers.py", line 180, in finish_response
self.write(data)
File "/usr/lib64/python3.7/wsgiref/handlers.py", line 274, in write
self.send_headers()
File "/usr/lib64/python3.7/wsgiref/handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "/usr/lib64/python3.7/wsgiref/handlers.py", line 344, in client_is_modern
return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib64/python3.7/socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib64/python3.7/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib64/python3.7/socketserver.py", line 720, in __init__
self.handle()
File "/home/ec2-user/venv/lib/python3.7/site-packages/django/core/servers/basehttp.py", line 154, in handle
handler.run(self.server.get_app())
File "/usr/lib64/python3.7/wsgiref/handlers.py", line 144, in run
self.close()
File "/usr/lib64/python3.7/wsgiref/simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'