django 1.10.3冲洗后无法解析碱基

时间:2016-11-28 17:46:31

标签: python django

我有一个模型开发的游乐场。

运行python manage.py makemigrations错误

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/home/IPP-HGW/dboe/anaconda2/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/home/IPP-HGW/dboe/anaconda2/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/IPP-HGW/dboe/anaconda2/lib/python2.7/site-packages/django/core/management/base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/IPP-HGW/dboe/anaconda2/lib/python2.7/site-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/home/IPP-HGW/dboe/anaconda2/lib/python2.7/site-packages/django/core/management/commands/makemigrations.py", line 173, in handle
    migration_name=self.migration_name,
  File "/home/IPP-HGW/dboe/anaconda2/lib/python2.7/site-packages/django/db/migrations/autodetector.py", line 47, in changes
    changes = self._detect_changes(convert_apps, graph)
  File "/home/IPP-HGW/dboe/anaconda2/lib/python2.7/site-packages/django/db/migrations/autodetector.py", line 132, in _detect_changes
    self.old_apps = self.from_state.concrete_apps
  File "/home/IPP-HGW/dboe/anaconda2/lib/python2.7/site-packages/django/db/migrations/state.py", line 180, in concrete_apps
    self.apps = StateApps(self.real_apps, self.models, ignore_swappable=True)
  File "/home/IPP-HGW/dboe/anaconda2/lib/python2.7/site-packages/django/db/migrations/state.py", line 242, in __init__
    self.render_multiple(list(models.values()) + self.real_models)
  File "/home/IPP-HGW/dboe/anaconda2/lib/python2.7/site-packages/django/db/migrations/state.py", line 285, in render_multiple
    "for more" % (new_unrendered_models, get_docs_version())
django.db.migrations.exceptions.InvalidBasesError: Cannot resolve bases for [<ModelState: 'main.Component'>, <ModelState: 'main.MagneticConfig'>, <ModelState: 'main.NetStructure'>, <ModelState: 'main.Program'>, <ModelState: 'main.FilePath'>]
This can happen if you are inheriting models from an app with migrations (e.g. contrib.auth)
 in an app with no migrations; see https://docs.djangoproject.com/en/1.10/topics/migrations/#dependencies for more

虽然我尝试了很多事情但仍然存在:

  1. 当然是python manage.py makemigration <appName>
  2. python manage.py migrate <appName>
  3. 从应用中删除所有表格
  4. python manage.py squashmigrations main 0001
  5. 清空models.py文件
  6. 取消注释设置中的应用
  7. 阅读我能找到的所有内容
  8. 刷新整个数据库python manage.py flush
  9. 任何想法,如何解决这个问题?谢谢, 丹尼尔

    编辑Nov_29: 添加了堆栈跟踪

1 个答案:

答案 0 :(得分:0)

最后我得到了解决方案。我发现,迁移存储在应用程序文件夹中的文件中。您可以手动删除这些。当然,你需要非常小心。

如果遇到同样的问题,请查看this