gpt4 book ai didi

python - django-south 迁移期间出错

转载 作者:行者123 更新时间:2023-11-29 12:29:31 25 4
gpt4 key购买 nike

当我尝试使用 South 在 django 中迁移时,出现以下错误。

Running migrations for sites:
- Migrating forwards to 0004_initial.
> sites:0002_initial
FATAL ERROR - The following SQL query failed: CREATE TABLE `django_site` (`id`
nteger AUTO_INCREMENT NOT NULL PRIMARY KEY, `domain` varchar(100) NOT NULL, `na
e` varchar(50) NOT NULL)
The error was: (1050, "Table 'django_site' already exists")
! Error found during real run of migration! Aborting.

! Since you have a database that does not support running
! schema-altering statements in transactions, we have had
! to leave it in an interim state between migrations.

! You *might* be able to recover with: = DROP TABLE `django_site` CASCADE; []

! The South developers regret this has happened, and would
! like to gently persuade you to consider a slightly
! easier-to-deal-with DBMS (one that supports DDL transactions)
! NOTE: The error which caused the migration to fail is further up.
Error in migration: sites:0002_initial
Traceback (most recent call last):
File "manage.py", line 10, in <module>
.............

django.db.utils.OperationalError: (1050, "Table 'django_site' already exists")

类似的问题也已开放here .有什么解决办法吗?该错误似乎是由于 github 问题中讨论的 Create table 语句造成的,或者可能还有其他错误。我无法弄清楚。

最佳答案

如果 Django 版本 < 1.7

python manage.py migrate yourapp --fake

其他

python manage.py migrate --fake

--fake:将迁移序列记录为已应用,但并不实际运行它。 -> more

关于python - django-south 迁移期间出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27775433/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com