我最近從Django 1.3升級到1.8,並且遇到了嘗試進行遷移設置時遇到的問題。以前使用過South,並通過settings.py卸載它,並在每個應用中刪除它們的文件夾。KeyError:u'editable'首次執行./manage.py遷移時
當試圖安裝遷移我得到這個錯誤:
[email protected]:/home/# python manage.py migrate
Operations to perform:
Synchronize unmigrated apps: web_forms, staticfiles, tinymce, messages, miscellaneous, generalpagess, gallery, template, import, navigation, frontpage, association
Apply all migrations: admin, contenttypes, sites, auth, sessions
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 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
utility.execute()
File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 394, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 445, in execute
output = self.handle(*args, **options)
File "/usr/lib/python2.7/dist-packages/django/core/management/commands/migrate.py", line 222, in handle
executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
File "/usr/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 100, in migrate
state.apps # Render all real_apps -- performance critical
File "/usr/lib/python2.7/dist-packages/django/utils/functional.py", line 59, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/lib/python2.7/dist-packages/django/db/migrations/state.py", line 166, in apps
return StateApps(self.real_apps, self.models)
File "/usr/lib/python2.7/dist-packages/django/db/migrations/state.py", line 226, in __init__
self.real_models.append(ModelState.from_model(model, exclude_rels=True))
File "/usr/lib/python2.7/dist-packages/django/db/migrations/state.py", line 345, in from_model
name, path, args, kwargs = field.deconstruct()
File "/usr/lib/python2.7/dist-packages/django/db/models/fields/__init__.py", line 1253, in deconstruct
del kwargs['editable']
KeyError: u'editable'
運行makemigrations
[email protected]:/home/# python manage.py makemigrations
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
utility.execute()
File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 394, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 445, in execute
output = self.handle(*args, **options)
File "/usr/lib/python2.7/dist-packages/django/core/management/commands/makemigrations.py", line 99, in handle
ProjectState.from_apps(apps),
File "/usr/lib/python2.7/dist-packages/django/db/migrations/state.py", line 178, in from_apps
model_state = ModelState.from_model(model)
File "/usr/lib/python2.7/dist-packages/django/db/migrations/state.py", line 345, in from_model
name, path, args, kwargs = field.deconstruct()
File "/usr/lib/python2.7/dist-packages/django/db/models/fields/__init__.py", line 1253, in deconstruct
del kwargs['editable']
KeyError: u'editable'
時一直在抓取互聯網試圖找到一個解決這個我也得到同樣的錯誤,但沒有骰子。
我希望你先運行'''makemigrations'''? –
謝謝@SijanBhandari我也從那裏得到了同樣的錯誤 –
請將您的models.py與遷移相關。 –