使用wagtail 2.0迁移错误

时间:2018-05-18 13:55:23

标签: django wagtail

您好我正在尝试升级到wagtail 2.0。我已经处理了一系列错误,但我无法通过迁移时发生的错误:

  File "/Users/tim/wagtailcmsdemo/home/migrations/0001_initial.py", line 17, in Migration
    ('page_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
TypeError: __init__() missing 1 required positional argument: 'on_delete'

任何帮助非常感谢

由于

完整控制台错误:

  

(wagtail-isa)MacBook-Air:wagtailcmsdemo tim $ ./manage.py   makemigrations Traceback(最近一次调用最后一次):文件   " ./ manage.py",第10行,in       execute_from_command_line(sys.argv)File" /Users/tim/Virtualenvs/wagtail-isa/lib/python3.6/site-packages/django/core/management/ init .py&#34 ;,   第371行,在execute_from_command_line中       utility.execute()文件" /Users/tim/Virtualenvs/wagtail-isa/lib/python3.6/site-packages/django/core/management/ init .py" ,   第365行,执行中       self.fetch_command(子命令).run_from_argv(self.argv)File" /Users/tim/Virtualenvs/wagtail-isa/lib/python3.6/site-packages/django/core/management/base.py" ;,   第288行,在run_from_argv中       self.execute(* args,** cmd_options)File" /Users/tim/Virtualenvs/wagtail-isa/lib/python3.6/site-packages/django/core/management/base.py",   第335行,执行中       output = self.handle(* args,** options)File" /Users/tim/Virtualenvs/wagtail-isa/lib/python3.6/site-packages/django/core/management/commands/makemigrations.py& #34 ;,   第78行,在句柄中       loader = MigrationLoader(None,ignore_no_migrations = True)File" /Users/tim/Virtualenvs/wagtail-isa/lib/python3.6/site-packages/django/db/migrations/loader.py",   第49行,在 init 中       self.build_graph()File" /Users/tim/Virtualenvs/wagtail-isa/lib/python3.6/site-packages/django/db/migrations/loader.py",   第200行,在build_graph中       self.load_disk()File" /Users/tim/Virtualenvs/wagtail-isa/lib/python3.6/site-packages/django/db/migrations/loader.py",   第109行,在load_disk中       migration_module = import_module("%s。%s"%(module_name,migration_name))文件   " /Users/tim/Virtualenvs/wagtail-isa/lib/python3.6/importlib/的初始化的.py&#34 ;,   第126行,在import_module中       return _bootstrap._gcd_import(name [level:],package,level)文件"",第978行,在_gcd_import文件中   "",第961行,在_find_and_load文件中   "",第950行,在_find_and_load_unlocked中   文件"",第655行,在_load_unlocked中   文件"",第678行,in   exec_module文件"",第205行,in   _call_with_frames_removed File" /Users/tim/wagtailcmsdemo/home/migrations/0001_initial.py" ;,第7行,   在       class Migration(migrations.Migration):File" /Users/tim/wagtailcmsdemo/home/migrations/0001_initial.py" ;,第17行,   在迁移中       (' page_ptr',models.OneToOneField(parent_link = True,auto_created = True,primary_key = True,serialize = False,   to =' wagtailcore.Page')),TypeError: init ()缺少1需要   位置论证:' on_delete'

1 个答案:

答案 0 :(得分:2)

docs of wagtail v2.0.1 compatibility

  

Wagtail在Python 3.4,3.5和3.6上支持Django 1.11.x和2.0。支持的数据库后端是PostgreSQL,MySQL和SQLite。

但你尝试使用Django> = 1.11 和版本1.11的doc django ForeignKey

  

(实际上并不需要on_delete,但是没有提供它会给出弃用警告。在Django 2.0中将需要它。)