gpt4 book ai didi

python - Django: ConnectionAbortedError: [WinError 10053] 已建立的连接被主机中的软件中止

转载 作者:可可西里 更新时间:2023-11-01 10:41:23 30 4
gpt4 key购买 nike

我有一个要在本地运行的 Django 应用程序。我在 win32 上运行 Python 3.7。我在 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/时出现问题。发生的事情是我会在命令提示符中收到此错误:

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

我不确定如何摆脱这个错误。

最佳答案

如果您在 Windows 上使用 PostgreSQL,您可能会遇到代码页问题。

>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 之前设置代码页。

> cmd.exe /c chcp 1252

关于python - Django: ConnectionAbortedError: [WinError 10053] 已建立的连接被主机中的软件中止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54465300/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com