django runserver: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid st
2023-06-13 09:18:39 时间
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.
相关文章
- Python进阶25-Django Web框架
- Python进阶34-Django 中间件
- Django-Admin后台管理内容
- 一次完整的 Django 项目的迁移,有关 MySQL 数据库的导出与导入
- Django 中使用 ajax 请求的正确姿势
- pycharm怎么运行django项目_django怎么用
- 使用python的Django库开发一个简单的数据可视化网站(三)- 使用Django连接数据库mysql
- Django(19)QuerySet API[通俗易懂]
- Django(17)orm查询操作[通俗易懂]
- Django(13)django时区问题
- Django(8)reverse函数「建议收藏」
- django 中 media配置
- 【Django】在大型项目中的django的性能模型字段primary_key
- Django+Celery学习笔记3——django+celery+redis实现异步任务与定时任务
- django 按年月日归档
- Add a button/form/link to Django Admin(添加按钮、表单、链接到 django admin)
- 在Django中使用MQTT的方法
- django 设置中间件(middleware),禁止某些用户访问站点
- django import_export export 导出时新增自定义字段
- Django REST Framework-常用的权限类型
- Django REST Framework-过滤器(一)
- Django使用redis配置缓存的方法
- Linux系统下部署Django网站快速指南(linux 部署django)
- 在Windows8上的搭建Python和Django环境