我正在使用Django 1.6和South进行迁移。我只有一个夹具initial_data.json
。当我运行./manage.py syncdb
时,我得到了
Installed 48 object(s) from 1 fixture(s)
然而,当我运行./manage.py migrate
时,我得到了
Installed 96 object(s) from 2 fixture(s)
看起来信息翻倍。如何在migrate命令中查看完全安装的灯具?这个问题对我来说很重要,因为我在项目中的某些其他地方加载了夹具数据,这可能就是原因。
upd 我按照建议将数据迁移到migrate
上的加载装置,但是有两次迁移而不是一次迁移的问题仍然存在:
./manage.py migrate
Running migrations for hello:
- Migrating forwards to 0007_migration_fixture.
> hello:0007_migration_fixture
- Migration 'hello:0007_migration_fixture' is marked for no-dry-run.
Installed 102 object(s) from 2 fixture(s)
- Loading initial data for hello.
Installed 0 object(s) from 0 fixture(s)
答案 0 :(得分:3)
请勿在南方使用initial_data
灯具。将initial_data.json
重命名为其他名称和load this fixture in the data migration:
def forwards(self, orm):
from django.core.management import call_command
call_command("loaddata", "my_fixture.json")