django runserver: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid st
2023-03-07 09:46:16 时间
windows 下,django runserver 时报错:UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte
(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.
相关文章
- 在 Go 里用 CGO?这 7 个问题你要关注!
- 9款优秀的去中心化通讯软件 Matrix 的客户端
- 求职数据分析,项目经验该怎么写
- 在OKR中,我看到了数据驱动业务的未来
- 火山引擎云原生大数据在金融行业的实践
- OpenHarmony富设备移植指南(二)—从postmarketOS获取移植资源
- 《数据成熟度指数》报告:64%的企业领袖认为大多数员工“不懂数据”
- OpenHarmony 小型系统兼容性测试指南
- 肯睿中国(Cloudera):2023年企业数字战略三大趋势预测
- 适用于 Linux 的十大命令行游戏
- GNOME 截图工具的新旧截图方式
- System76 即将推出的 COSMIC 桌面正在酝酿大变化
- 2GB 内存 8GB 存储即可流畅运行,Windows 11 极致精简版系统 Tiny11 发布
- 迎接 ecode:一个即将推出的具有全新图形用户界面框架的现代、轻量级代码编辑器
- loongarch架构介绍(三)—地址翻译
- Go 语言怎么解决编译器错误“err is shadowed during return”?
- 敏捷:可能被开发人员遗忘的部分
- Denodo预测2023年数据管理和分析的未来
- 利用数据推动可持续发展
- 在 Vue3 中实现 React 原生 Hooks(useState、useEffect),深入理解 React Hooks 的