南django迁移 [英] south django migrate

查看:145
本文介绍了南django迁移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚做过:

python manage.py schemamigration TestDBapp1 --initial
python manage.py schemamigration TestDBapp1 --auto

成功。

但是如果我输入: python manage.py migrate TestDBapp1

我得到这个: sqlite3。操作错误:表TestDBapp1_xyz已经存在

可能是什么问题?

推荐答案

我怀疑你已经执行了创建表的 syncdb 。南方尝试在迁移期间重新创建它们,并且数据库自然而然地抱怨。

I suspect that you already executed syncdb which created the tables. South tries to create them again during migrate and naturally the database complains.

为了避免这种情况,你必须告诉南方假的的初始迁移。

To avoid this you have to tell South to "fake" the initial migration.

python manage.py migrate TestDBapp1 --fake

正如名称所示,这假装要迁移。请注意,这是一个一次性。南将处理你的未来 syncdb 迁移而不需要 - 假的/ / code>。

As the name indicates this pretends to migrate. Note that this is an one time step. South will handle your future syncdb and migrate without requiring --fake.

这篇关于南django迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆