python - Digital Ocean 连接上的 Django 服务器被对等方重置
问题描述
我正在尝试使用 Django 2.0.4 和 Ubuntu 16.0.4 液滴在我的数字海洋实例上设置 django 服务器。我以 root 身份 ssh 进入 droplet 并使用以下命令启动服务器
python manage.py runserver 0.0.0.0:80
django 服务器可以正常启动。但是几秒钟后,我没有做任何事情,这些错误会反复出现:
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('175.100.8.37', 12774)
Traceback (most recent call last):
File "/usr/lib/python3.5/socketserver.py", line 625, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python3.5/socketserver.py", line 354, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python3.5/socketserver.py", line 681, in __init__
self.handle()
File "/root/website/back-end/env/lib/python3.5/site-packages/django/core/servers/basehttp.py", line 139, in handle
self.raw_requestline = self.rfile.readline(65537)
File "/usr/lib/python3.5/socket.py", line 575, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [Errno 104] Connection reset by peer
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('175.100.8.37', 12775)
Traceback (most recent call last):
File "/usr/lib/python3.5/socketserver.py", line 625, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python3.5/socketserver.py", line 354, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python3.5/socketserver.py", line 681, in __init__
self.handle()
File "/root/website/back-end/env/lib/python3.5/site-packages/django/core/servers/basehttp.py", line 139, in handle
self.raw_requestline = self.rfile.readline(65537)
File "/usr/lib/python3.5/socket.py", line 575, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [Errno 104] Connection reset by peer
----------------------------------------
这是我的ALLOWED_HOSTS
设置:
ALLOWED_HOSTS = [
"tedxuwa.com",
"www.tedxuwa.com",
"localhost:8000"
]
DEBUG
设置为 False,我绝对不是提出这些请求的人。为什么会发生这些错误?
解决方案
推荐阅读
- c# - 没有角色的自定义用户权限 c#
- node.js - 如何使用nodejs将数据数组转换为合并的html表
- c++ - GCC、CMake、预编译头文件和维护依赖项
- c# - 无法打开运行 exe 生成的输出文件
- r - tagAssert(body, type = "div", class = "content-wrapper") 中的错误:缺少参数“body”,没有默认值
- c - [C]:使用 strcpy() 到字符串数组的分段错误
- angular - 当用户点击它时,用其中的新元素展开 li
- php - 日本货币格式以提高可读性
- oracle - weblogic 12c 中的应用程序状态保持“已准备好”
- python - google django“无法连接到‘127.0.0.1’上的 MySQL 服务器