Python Django Errno 54 'Connection reset by peer'

前端 未结 4 1508
失恋的感觉
失恋的感觉 2021-01-07 18:32

Having some trouble debugging this. I get this error always when i first start my app up, then intermittently thereafter. Could someone please help me by throwing out some d

相关标签:
4条回答
  • 2021-01-07 18:52

    I came across the same issue ConnectionResetError: [Errno 54] Connection reset by peer.

    In my case the issue was trying to serve static files through development server with debug settings to False, development server can serve static files only when debug is set to True in settings file.

    In my settings file i replace

    DEBUG = False
    

    with

    DEBUG = True
    

    After that, I restart my development server and it works for me!

    0 讨论(0)
  • 2021-01-07 18:58

    I also encountered this issue when i switch from development to production.

    After i do collectstatic it worked normal again, my guess is it's missing static dir path for production

    do this before you switch to production environment

    python manage.py collectstatic

    0 讨论(0)
  • 2021-01-07 19:04

    FFS... so dumb. I noticed that it was always resetting after not finding a favicon so I added one... Even though I never explicitly loaded one, django appears to try and load a default one from the root of the project... This doesn't happen for any of the other devs working on the project either. weird. (For completeness) If anyone else stumbles upon this i used favicon io to make a simple text one. Then i loaded it into my html like so:

    {% load static %}
    <!DOCTYPE html>
    <html lang="en">
    
    <head>
      <link rel="shortcut icon" href="{% static 'images/favicon.ico' %}" />
    ...
    

    Be sure to set your static path correctly in settings.

    0 讨论(0)
  • 2021-01-07 19:07

    The same behaviour is seen if the favicon is in .png format as opposed to .ico.

    Also, contrary to advice seen on other sites, downgrading Python to v3.6 does not solve the problem. screenshot of error w. png favicon

    Seems to be a Django issue, It will probably be fixed permanently in a future Django release.

    Following https://bugs.python.org/issue27682#msg348302 I made the changes shown:

    I then replaced BrokenPipeError with ConnectionAbortedError. This seems to handle the exception.

    0 讨论(0)
提交回复
热议问题