在django 1.7中迁移时出错

时间:2014-11-09 16:27:45

标签: django django-models

当我做makemigrations项目时没关系,之后当我尝试迁移时,出现了错误。这是怎么发生的?请帮忙

=========ERROR MESSAGE===================

Operations to perform:
  Apply all migrations: projects, profiles, auth, admin, sessions, polls, contenttypes
Running migrations:
  Applying projects.0001_initial...Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Django-1.7-py3.4.egg/django/apps/config.py", line 158, in get_model
    return self.models[model_name.lower()]
KeyError: 'project'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Django-1.7-py3.4.egg/django/db/migrations/state.py", line 79, in render
    model = self.apps.get_model(lookup_model[0], lookup_model[1])
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Django-1.7-py3.4.egg/django/apps/registry.py", line 202, in get_model
    return self.get_app_config(app_label).get_model(model_name.lower())
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Django-1.7-py3.4.egg/django/apps/config.py", line 161, in get_model
    "App '%s' doesn't have a '%s' model." % (self.label, model_name))
LookupError: App 'projects' doesn't have a 'project' model.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Django-1.7-py3.4.egg/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Django-1.7-py3.4.egg/django/core/management/__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Django-1.7-py3.4.egg/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Django-1.7-py3.4.egg/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Django-1.7-py3.4.egg/django/core/management/commands/migrate.py", line 160, in handle
    executor.migrate(targets, plan, fake=options.get("fake", False))
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Django-1.7-py3.4.egg/django/db/migrations/executor.py", line 63, in migrate
    self.apply_migration(migration, fake=fake)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Django-1.7-py3.4.egg/django/db/migrations/executor.py", line 97, in apply_migration
    migration.apply(project_state, schema_editor)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Django-1.7-py3.4.egg/django/db/migrations/migration.py", line 107, in apply
    operation.database_forwards(self.app_label, schema_editor, project_state, new_state)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Django-1.7-py3.4.egg/django/db/migrations/operations/models.py", line 33, in database_forwards
    apps = to_state.render()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Django-1.7-py3.4.egg/django/db/migrations/state.py", line 89, in render
    model=lookup_model,
ValueError: Lookup failed for model referenced by field projects.Likes.project: projects.Project

0 个答案:

没有答案
相关问题