大部分取决于代码
该项目根本没有迁移
./manage.py makemigrations
./manage.py migrate
该项目有南迁移:
你可以:
南迁south_migrations
或者
彻底消除南迁
和
./manage.py makemigrations
./manage.py migrate
如果您选择选项1
,您必须记住在两个系统(south 和 django)上保持最新的迁移。仅当您想保持 django <1.7 的兼容性时,这才有用
你有一个可插拔的应用程序
这是最复杂的情况,因为您必须保持南方兼容性,并且您必须管理不同版本的南方。这里是如何:
- 南迁
south_migrations
- 运行 ./manage.py makemigrations
- 为防止 South 加载错误的迁移,将以下代码放入
migration.__init__.py
```
"""
Django migrations
This package does not contain South migrations. South migrations can be found
in the ``south_migrations`` package.
"""
SOUTH_ERROR_MESSAGE = """\n
For South support, customize the SOUTH_MIGRATION_MODULES setting like so:
SOUTH_MIGRATION_MODULES = {
'wfp_auth': 'wfp_auth.south_migrations',
}
"""
# Ensure the user is not using Django 1.6 or below with South
try:
from django.db import migrations # noqa
except ImportError:
from django.core.exceptions import ImproperlyConfigured
raise ImproperlyConfigured(SOUTH_ERROR_MESSAGE)
```