搭建Django框架的时候遇到这样的一个报错
报错信息
C:\workspace\anconda\lib\site-packages\django\db\models\base.py:299: RuntimeWarning: Model ‘fokinApp.wptermtaxonomy’ was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
C:\workspace\anconda\lib\site-packages\django\db\models\base.py:299: RuntimeWarning: Model ‘fokinApp.wptermmeta’ was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
C:\workspace\anconda\lib\site-packages\django\db\models\base.py:299: RuntimeWarning: Model ‘fokinApp.wpterms’ was already registered. Reloading
同步已有数据库到Django框架报错
最新推荐文章于 2024-08-11 09:12:58 发布
在尝试将已有数据库同步到Django时遇到了RuntimeWarning,提示模型已经注册。错误源于在models.py文件中存在重复的类定义。通过删除models.py中的重复部分解决了问题,从而成功完成数据库同步。
摘要由CSDN通过智能技术生成