数据库迁移失败(第2章第6节)
来源:2-6 让工程在ubuntu上run起来
Oo熊小猫oO
2018-04-09
老师您好,我在执行数据库迁移的时候报错,看着像模块冲突,不知如何解决,烦请帮忙看下,感谢
$ python ./main.py markmigrations /home/panda/Workspace/code/imoocc/apps/detail/models.py:7: RemovedInDjango19Warning: Model class detail.models.ConnectionInfo doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS or else was imported before its application was loaded. This will no longer be supported in Django 1.9. class ConnectionInfo(models.Model): Traceback (most recent call last): File "./main.py", line 34, in <module> from apps.detail.utils.machines import Machines File "/home/panda/Workspace/code/imoocc/apps/detail/utils/machines.py", line 3, in <module> from detail.models import * File "/home/panda/Workspace/code/imoocc/apps/detail/models.py", line 7, in <module> class ConnectionInfo(models.Model): File "/usr/lib/python2.7/site-packages/django/db/models/base.py", line 309, in __new__ new_class._meta.apps.register_model(new_class._meta.app_label, new_class) File "/usr/lib/python2.7/site-packages/django/apps/registry.py", line 221, in register_model (model_name, app_label, app_models[model_name], model)) RuntimeError: Conflicting 'connectioninfo' models in application 'detail': <class 'apps.detail.models.ConnectionInfo'> and <class 'detail.models.ConnectionInfo'>.
写回答
1回答
-
Jeson
2018-04-11
你好,你把django模块重新安装到1.8.2版本。执行如下命令:
/opt/python2.7/bin/pip install --upgrade django==1.8.2
然后,清空工程目录下的迁移文件(保留__init__.py文件),migrations目录下这些文件:
然后执行工程再执行下迁移
00
相似问题