django inspectdb utf8mb4错误 [英] django inspectdb utf8mb4 error

查看:256
本文介绍了django inspectdb utf8mb4错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使在所有表都写完之后,Python manage.py inspectdb也给出以下错误 具有CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci

Python manage.py inspectdb is giving following error even after all tables are having CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci

从django.db导入模型

from django.db import models

推荐答案

我最近遇到了完全相同的问题. 我向Django提出了错误请求,但Django不接受该错误作为他们的错误.

I encountered the exact same issue lately. I raised a bug request to Django, but Django do not accept it as their bug.

MySQL 8已从UTF8MB3切换为UTF8MB4作为默认字符集.从

MySQL 8 has switched from UTF8MB3 to UTF8MB4 as the default charset. As of 8.0.11 if you access a table that was created with the previous version a warning is returned encouraging you to switch to UTF8MB4.

运行inspectdb时,INFORMATION_SCHEMA表仍位于UTF8MB3中,因此您将警告返回给Django,而Django目前无法忽略该警告.

When you run the inspectdb the INFORMATION_SCHEMA tables are still in UTF8MB3 so you get the warning returned to Django, which Django is currently unable to ignore.

我有一个完全有效的示例,该示例如何解决Django错误凭单上的此错误: https://code.djangoproject.com/ticket/29678

I have a fully worked example of how to get around this error on the Django bug ticket: https://code.djangoproject.com/ticket/29678

我已经能够完全使用MySQL 8.0.12作为健壮的Django应用程序的后端 因此,一旦您解决了这个问题,就应该可以了.

I have been able to fully use MySQL 8.0.12 as a backend for a robust Django application so once you get past this issue you should hopefully be okay.

这篇关于django inspectdb utf8mb4错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆