我有一个想要在本地运行的 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
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)