django:模块' django_mysql.models'没有属性' jsonfield;?
我正在运行Django 4.0。我有一个模型,上面宣告了这样的字段:
industries = models.JSONField()
在Makemigration上,Django抛出了错误:
模块'django_mysql.models'没有属性'jsonfield'
至少有3个以前的帖子。他们建议使用我正在做的Django的 models.jsonfield()
。
我正在使用:
- DJANGO 4.0
- PYTHON 3.9.13
- DJANGO-MYSQL 4.7.0
为什么我会收到此错误消息?
更新
可能以某种方式相关:从2019年起,错误就会在旧的迁移文件中丢弃。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
感谢Willem van Onsem的答案。他指出,我仍然必须引用
django_mysql.models.jsonfield
以某种方式。果然,我有这样做的旧迁移文件。 (and 关于如何解决这个问题。)@willem,如果您想以答案的形式发表评论,我将标记为接受的答案。
Thanks to Willem Van Onsem for the answer. He pointed out that I must still be referencing
django_mysql.models.JSONField
somehow. Sure enough, I had old migration files that were doing that. (And here's the SO thread about how to fix that.)@Willem, if you'd like to post your comment in the form of an answer here, I will mark it as the accepted answer.