Django:ConnectionAbortedError:[WinError 10053]建立的连接被主机中的软件中止了 [英] Django: ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

查看:57
本文介绍了Django:ConnectionAbortedError:[WinError 10053]建立的连接被主机中的软件中止了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要在本地运行的Django应用程序.我在使用Python 3.7的win32上运行.我在Windows的命令提示符"中输入以下内容:

I have a Django application I want to run locally. I am running on win32 with Python 3.7. I enter the following into Command Prompt on Windows:

$ python manage.py runserver
Django version 2.07, using settings 'web.settings'
Starting development server at http://127.0.0.1:8000
Quit the server with CTRL-BREAK.

当我在浏览器中打开localhost:8000/时,问题就来了.发生什么事,我将在命令提示符中收到此错误:

The problem comes when I open to localhost:8000/ in my browser. What happens is I'll get this error in Command Prompt:

Traceback (most recent call last):
    File "C:\Program Files\Python37\lib\wsgiref\handlers.py", line 138, in run 
      self.finish_response()
    File "C:\Program Files\Python37\lib\wsgiref\handlers.py", line 180, in finish_response()
      self.write(data)
    File "C:\Programs Files\Python37\lib\wsgiref\handlers.py", line 279, in write
      self.write(data)
    File "C:\Programs Files\Python37\lib\wsgiref\handlers.py", line 453, in _write
      result = self.stdout.write(data)
    File "C:\Programs Files\Python37\lib\socketserver.py", line 796, in write
      self._sock.sendall(b)
 ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

我不确定如何消除此错误.

I am unsure how to get rid of this error.

推荐答案

如果在Windows上使用PostgreSQL,则可能会出现代码页问题.

If you're using PostgreSQL on Windows, you may have a code page issue.

>psql -U postgres
psql (9.6)
WARNING: Console code page (850) differs from Windows code page (1252)
     8-bit characters might not work correctly. See psql reference
     page "Notes for Windows users" for details.
Type "help" for help.

postgres=#

在启动Django之前,请尝试设置代码页.

Please try setting code page before launching Django.

> cmd.exe /c chcp 1252

这篇关于Django:ConnectionAbortedError:[WinError 10053]建立的连接被主机中的软件中止了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆