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

错误一:object supporting the buffer API required

Django数据库配置报错object supporting the buffer API required_第1张图片
需要将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’

Django数据库配置报错object supporting the buffer API required_第2张图片
定位到报错的地方:
Django数据库配置报错object supporting the buffer API required_第3张图片

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

Django数据库配置报错object supporting the buffer API required_第4张图片
定位到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:

你可能感兴趣的:(mysql,django,orm,django,drf算法,数据库,python,orm)