Django数据库配置报错object supporting the buffer API required

编程入门 行业动态 更新时间:2024-10-08 10:31:02

Django数据库配置<a href=https://www.elefans.com/category/jswz/34/1771188.html style=报错object supporting the buffer API required"/>

Django数据库配置报错object supporting the buffer API required

错误一:object supporting the buffer API required


需要将settings.py中mysql配置的密码改为字符穿:

DATABASES = {'default': {'ENGINE': 'django.db.backends.mysql',  # 数据库引擎'NAME': '名称','HOST':'127.0.0.1','PORT':3306,'USER':'root',#'PASSWORD':123456 # 之前写法'PASSWORD':'123456'  # 修改为字符串}
}

错误二:"AttributeError: ‘str’ object has no attribute ‘decod’


定位到报错的地方:

错误三:UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xa6 in position 9737: illegal multibyte sequence


定位到332行将:

with Path(CURRENT_DIR, 'templates', 'technical_500.html').open() as fh:

改为:

with Path(CURRENT_DIR, 'templates', 'technical_500.html').open(encoding='utf-8') as fh:

更多推荐

Django数据库配置报错object supporting the buffer API required

本文发布于:2024-03-09 20:03:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1725983.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:报错   数据库   object   Django   API

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!