2013-10-10 64 views

回答

2

使用南

pip install South 

首先,让你的Django模型完全符合当前的数据库表,然后运行:

python manage.py schemamigration myapp --initial 
python manage.py migrate myapp --fake 
#Make changes to your django model (add new field) 
python manage.py schemamigration myapp --auto 
python manage.py migrate myapp 
2

您需要执行“迁移”,目前在Django中执行此操作的最佳方法是使用名为South的工具。

结账their tutorial。在你做这件事之前,确保你做了一份你的db的拷贝,因为如果你是第一次使用South,你可能会搞砸了。

相关问题