錯誤一: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: