我有一個項目在django 1.6上運行,並將其升級到1.8,其中包括從南遷移到django的遷移。從南遷移到django 1.8提出表已存在
我試圖按照有關如何從南部更新到這裏Django的遷移https://docs.djangoproject.com/en/1.8/topics/migrations/#upgrading-from-south
&現在面臨試圖遷移--initial假票時,一個問題由Django文檔中提到的步驟,好像即使一些表存在Django遷移試圖創建它們
./manage.py migrate --fake-initial
Running migrations:
Rendering model states... DONE
Applying retail.0001_initial... FAKED
Applying contenttypes.0001_initial... FAKED
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0001_initial... FAKED
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying account.0001_initial... FAKED
Applying default.0001_initial...Traceback (most recent call last):
File "./manage.py", line 11, in <module>
execute_from_command_line(sys.argv)
File "/project-path/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/project-path/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/project-path/lib/python2.7/site-packages/django/core/management/base.py", line 393, in run_from_argv
self.execute(*args, **cmd_options)
File "/project-path/lib/python2.7/site-packages/django/core/management/base.py", line 444, in execute
output = self.handle(*args, **options)
File "/project-path/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 222, in handle
executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
File "/project-path/lib/python2.7/site-packages/django/db/migrations/executor.py", line 110, in migrate
self.apply_migration(states[migration], migration, fake=fake, fake_initial=fake_initial)
File "/project-path/lib/python2.7/site-packages/django/db/migrations/executor.py", line 148, in apply_migration
state = migration.apply(state, schema_editor)
File "/project-path/lib/python2.7/site-packages/django/db/migrations/migration.py", line 115, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/project-path/lib/python2.7/site-packages/django/db/migrations/operations/models.py", line 59, in database_forwards
schema_editor.create_model(model)
File "/project-path/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 286, in create_model
self.execute(sql, params or None)
File "/project-path/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 111, in execute
cursor.execute(sql, params)
File "/project-path/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/project-path/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/project-path/lib/python2.7/site-packages/django/db/utils.py", line 97, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/project-path/lib/python2.7/site-packages/django/db/backends/utils.py", line 62, in execute
return self.cursor.execute(sql)
django.db.utils.ProgrammingError: relation "social_auth_association" already exists
任何建議請?
問候,
但我沒有面臨循環依賴關係,其通過遷移開始的那點和執行,然後由於某種原因,它試圖創建一個實際存在的表 –
因此,如果僅爲特定應用程序應用遷移,您會得到相同的錯誤?在運行'makemigrations'之前,您可能對模型做了一些更改嗎? – zanderle
其實zanderle,它原來你提出的是正確的,並制定出來,只需要刪除pyc文件 –