关于django:wagtail 2.0的迁移错误

Migration error with wagtail 2.0

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

1
2
3
  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 (most recent call last): File
"./manage.py", line 10, in
execute_from_command_line(sys.argv) File"/Users/tim/Virtualenvs/wagtail-isa/lib/python3.6/site-packages/django/core/management/init.py",
line 371, in execute_from_command_line
utility.execute() File"/Users/tim/Virtualenvs/wagtail-isa/lib/python3.6/site-packages/django/core/management/init.py",
line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv) File"/Users/tim/Virtualenvs/wagtail-isa/lib/python3.6/site-packages/django/core/management/base.py",
line 288, in run_from_argv
self.execute(*args, **cmd_options) File"/Users/tim/Virtualenvs/wagtail-isa/lib/python3.6/site-packages/django/core/management/base.py",
line 335, in execute
output = self.handle(*args, **options) File"/Users/tim/Virtualenvs/wagtail-isa/lib/python3.6/site-packages/django/core/management/commands/makemigrations.py",
line 78, in handle
loader = MigrationLoader(None, ignore_no_migrations=True) File"/Users/tim/Virtualenvs/wagtail-isa/lib/python3.6/site-packages/django/db/migrations/loader.py",
line 49, in init
self.build_graph() File"/Users/tim/Virtualenvs/wagtail-isa/lib/python3.6/site-packages/django/db/migrations/loader.py",
line 200, in build_graph
self.load_disk() File"/Users/tim/Virtualenvs/wagtail-isa/lib/python3.6/site-packages/django/db/migrations/loader.py",
line 109, in load_disk
migration_module = import_module("%s.%s" % (module_name, migration_name)) File
"/Users/tim/Virtualenvs/wagtail-isa/lib/python3.6/importlib/init.py",
line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level) File"", line 978, in _gcd_import File
"", line 961, in _find_and_load File
"", line 950, in _find_and_load_unlocked
File"", line 655, in _load_unlocked
File"", line 678, in
exec_module File"", line 205, in
_call_with_frames_removed File"/Users/tim/wagtailcmsdemo/home/migrations/0001_initial.py", line 7,
in
class Migration(migrations.Migration): 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 v2.0.1兼容性文档

Wagtail supports Django 1.11.x and 2.0 on Python 3.4, 3.5 and 3.6. Supported database backends are PostgreSQL, MySQL and SQLite.

但你尝试使用Django> = 1.11
并通过doc django ForeignKey获得版本1.11

(on_delete isn’t actually required, but not providing it gives a deprecation warning. It will be required in Django 2.0.)