前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >django runserver: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid st

django runserver: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid st

作者头像
卓越笔记
发布2023-02-18 10:26:47
5810
发布2023-02-18 10:26:47
举报
文章被收录于专栏:卓越笔记

windows 下,django runserver 时报错:UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte

代码语言:javascript
复制
(venv) E:\Program Files (x86)\Git\workspace\dingzhi\dzPython\web\demo>python manage.py runserver 127.0.0.1:8000
Performing system checks...

System check identified no issues (0 silenced).

You have 14 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
May 25, 2020 - 20:00:55
Django version 2.0, using settings 'demo.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Exception ignored in thread started by: <function check_errors.<locals>.wrapper at 0x000001A30091E430>
Traceback (most recent call last):
  File "E:\Program Files (x86)\Git\workspace\dingzhi\dzPython\web\venv\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "E:\Program Files (x86)\Git\workspace\dingzhi\dzPython\web\venv\lib\site-packages\django\core\management\commands\runserver.py", line 141, in inner_run
    run(self.addr, int(self.port), handler,
  File "E:\Program Files (x86)\Git\workspace\dingzhi\dzPython\web\venv\lib\site-packages\django\core\servers\basehttp.py", line 163, in run
    httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
  File "E:\Program Files (x86)\Git\workspace\dingzhi\dzPython\web\venv\lib\site-packages\django\core\servers\basehttp.py", line 66, in __init__
    super().__init__(*args, **kwargs)
  File "e:\python\lib\socketserver.py", line 452, in __init__
    self.server_bind()
  File "e:\python\lib\wsgiref\simple_server.py", line 50, in server_bind
    HTTPServer.server_bind(self)
  File "e:\python\lib\http\server.py", line 140, in server_bind
    self.server_name = socket.getfqdn(host)
  File "e:\python\lib\socket.py", line 756, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte

很可能的原因你的是 电脑名称(计算机名称)含有中文,我们需要把含有中文计算机名称改成全英文的,然后重启电脑再次 runserver.

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019-9-2 10,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档