报错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
发布评论