1
votes

Anytime when the program calls for either favicon.ico or any admin css files, I'm getting the ConnectionResetError: [Errno 54] Connection reset by peer

I'm using

Django==3.0.4
Python 3.6.1

For any of the below calls

"GET /favicon.ico HTTP/1.1" 404 2104
"GET /static/admin/css/fonts.css HTTP/1.1" 200 423
"GET /static/admin/css/changelists.css HTTP/1.1" 200 4096
"GET /static/admin/css/dashboard.css HTTP/1.1" 200 412
"GET /static/admin/css/widgets.css HTTP/1.1" 200 4096

I'm getting Traceback error like

Exception happened during processing of request from ('127.0.0.1', 60974)
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socketserver.py", line 639
, in process_request_thread
    self.finish_request(request, client_address)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socketserver.py", line 361
, in finish_request
    self.RequestHandlerClass(request, client_address, self)

  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socketserver.py", line 696
, in __init__
    self.handle()
  File "/Users/sunilhn/Documents/programming/Envs/proenv/lib/python3.6/site-packages/django/core/s
ervers/basehttp.py", line 174, in handle
    self.handle_one_request()
  File "/Users/sunilhn/Documents/programming/Envs/proenv/lib/python3.6/site-packages/django/core/s
ervers/basehttp.py", line 182, in handle_one_request
    self.raw_requestline = self.rfile.readline(65537)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 586, in r
eadinto
    return self._sock.recv_into(b)
ConnectionResetError: [Errno 54] Connection reset by peer

The program runs fine in the frontend without any issues. But this error in console is bugging me.

3
I think it's related to ThisSajad

3 Answers

3
votes

I've been having the same problem. The error was thrown after this line:

[01/Apr/2020 17:13:16] "GET /static/assets/img/logo-white.png HTTP/1.1" 200 9928

The image was loading fine on the front end and this was the template code:

<img src="{% static 'assets/img/logo-white.png' %}" width="50px" class="logo">

I added a closing slash to the tag and the error disappeared.

<img src="{% static 'assets/img/logo-white.png' %}" width="50px" class="logo" />

I wish i could explain why it worked, but it didn't - if someone can enlighten me, please do!

But leaving it here incase it helps anyone else.

0
votes

After verifying I think changing type="submit" to type="button" in html button calling ajax function did the trick.

0
votes

I resolved this exception (ConnectionResetError: [Errno 54] Connection reset by peer) by disabling the Firefox (87.0) Adblock Plus extension.

( Python==3.7 | Django==2.2 )