Django oauth toolkit: миграция выдает ошибку типа - руководство по началу работы

Я пытаюсь следовать руководству по началу работы для django oauth инструментарий от:

https://django-oauth-toolkit.readthedocs.io/en/latest/rest-framework/getting_started.html

Когда я бегу migrateЯ получаю эту ошибку:

Файл "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/backends/base/schema.py", строка 1003, в _constraint_names, если type_ не равен None, и infodict['type']!= type_: KeyError: 'type'

Любая помощь будет оценена.

Полная трассировка стека

Operations to perform:
  Apply all migrations: admin, auth, contenttypes, oauth2_provider, sessions
Running migrations:
  Applying oauth2_provider.0004_auto_20160525_1623...Traceback (most recent call last):
  File "/Users/lr/lrapp1/manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 204, in handle
    fake_initial=fake_initial,
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/migrations/executor.py", line 115, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/migrations/migration.py", line 129, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/migrations/operations/fields.py", line 216, in database_forwards
    schema_editor.alter_field(from_model, from_field, to_field)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 515, in alter_field
    old_db_params, new_db_params, strict)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 572, in _alter_field
    index_names = self._constraint_names(model, [old_field.column], index=True, type_=Index.suffix)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 1003, in _constraint_names
    if type_ is not None and infodict['type'] != type_:
KeyError: 'type'

0 ответов

Похоже, эта ошибка была вызвана миграцией oauth2_provider. Вы сможете исправить это, зайдя в {your venv}/Lib/site-packages/oauth2_provider/migrations и удалив все файлы миграции (кроме init.py), а затем снова запустите migrate. Надеюсь, это будет полезно

Другие вопросы по тегам