Django RuntimeWarning: Model ” was already registered.
Django项目中创建新app时报错
1 2 3 |
python manage.py startapp wp E:\python-base\Envs\django_env\lib\site-packages\django\db\models\base.py:309: RuntimeWarning: Model 'book.artical' 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) |
解决办法: 请注意红色文字,表示book app下的models.py中重复定义了article类。删除其中一个就能解决问题。
Read more