'I get 'connection reset by peer' error when I use django to upload file
I use the django framework to implement the function of uploading files, the local test is normal, and the following errors occur after deploying to the server. My code is as follows
if request.method == 'POST':
file_obj111 = request.FILES.get('file111')
f = open('/home/file_loca/' + file_obj111.name, 'wb')
for chunk in file_obj111.chunks():
f.write(chunk)
f.close()
It runs normally when tested locally.When I deployed to the server, an internal error appeared.
[22/Jul/2021 17:26:20] "POST /api/analysis/fuzzy_query HTTP/1.1" 200 15 qqq Internal Server Error: /api/analysis/fuzzy_query Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/django/http/request.py", line 391, in read return self._stream.read(*args, *kwargs) File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/wsgi.py", line 40, in read result = self.buffer + self._read_limited(size - len(self.buffer)) File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/wsgi.py", line 28, in _read_limited result = self.stream.read(size) File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/wsgi.py", line 40, in read result = self.buffer + self._read_limited(size - len(self.buffer)) File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/wsgi.py", line 28, in _read_limited result = self.stream.read(size) File "/usr/lib/python3.6/socket.py", line 586, in readinto return self._sock.recv_into(b) ConnectionResetError: [Errno 104] Connection reset by peer
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
