2017-08-22 123 views
0

我是django开发新手,我正在使用夹层== 4.2.2 CMS和django == 1.8。以前工作正常,但是从过去2天开始,它给了我在应用迁移时出现以下错误。Django - 不能申请迁移

python manage.py migrate 
Operations to perform: 
    Synchronize unmigrated apps: adminactions, raven_compat, staticfiles, boot, filebrowser_safe, djrill, sitemaps, compressor, django_countries, django_extensions, rest_framework, mailchimp, grappelli_safe, thumbnail, localflavor 
    Apply all migrations: shop, core, redirects, generic, django_comments, sessions, admin, report_builder, twitter, galleries, swingtime, sites, auth, blog, brochure, contenttypes, conf, forms, cities_light, checkout, pages 
Synchronizing apps without migrations: 
    Creating tables... 
    Running deferred SQL... 
    Installing custom SQL... 
Running migrations: 
    Rendering model states...Traceback (most recent call last): 
    File "manage.py", line 22, in <module> 
    execute_from_command_line(sys.argv) 
    File "/Users/VinayManeti/Documents/hedgehog_lab_projects/backend/venv/latest_gs/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line 
    utility.execute() 
    File "/Users/VinayManeti/Documents/hedgehog_lab_projects/backend/venv/latest_gs/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
    File "/Users/VinayManeti/Documents/hedgehog_lab_projects/backend/venv/latest_gs/lib/python2.7/site-packages/django/core/management/base.py", line 390, in run_from_argv 
    self.execute(*args, **cmd_options) 
    File "/Users/VinayManeti/Documents/hedgehog_lab_projects/backend/venv/latest_gs/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute 
    output = self.handle(*args, **options) 
    File "/Users/VinayManeti/Documents/hedgehog_lab_projects/backend/venv/latest_gs/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 221, in handle 
    executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial) 
    File "/Users/VinayManeti/Documents/hedgehog_lab_projects/backend/venv/latest_gs/lib/python2.7/site-packages/django/db/migrations/executor.py", line 104, in migrate 
    state = migration.mutate_state(state, preserve=do_run) 
    File "/Users/VinayManeti/Documents/hedgehog_lab_projects/backend/venv/latest_gs/lib/python2.7/site-packages/django/db/migrations/migration.py", line 83, in mutate_state 
    operation.state_forwards(self.app_label, new_state) 
    File "/Users/VinayManeti/Documents/hedgehog_lab_projects/backend/venv/latest_gs/lib/python2.7/site-packages/django/db/migrations/operations/fields.py", line 51, in state_forwards 
    state.reload_model(app_label, self.model_name_lower) 
    File "/Users/VinayManeti/Documents/hedgehog_lab_projects/backend/venv/latest_gs/lib/python2.7/site-packages/django/db/migrations/state.py", line 97, in reload_model 
    related_models = get_related_models_recursive(old_model) 
    File "/Users/VinayManeti/Documents/hedgehog_lab_projects/backend/venv/latest_gs/lib/python2.7/site-packages/django/db/migrations/state.py", line 57, in get_related_models_recursive 
    rel_app_label, rel_model_name = rel_mod._meta.app_label, rel_mod._meta.model_name 
AttributeError: 'NoneType' object has no attribute '_meta' 
+0

向我们展示您的模型。 – Siegmeyer

+0

我有160个表,它是非常大的文件 –

回答

0

也许任何引用为ForeignKey的相关模型之前,现在不存在。 确保所有相关字段配置正确。

+0

反正有没有检查未引用的字段? –

+0

反正我不知道检查未引用的字段。 – Rajez