Django 0.96 から初期データの import に JSON/XML 形式の fixture が使えるようになっています。 JSON形式は文字化けします。 see Ticket 3878 :(JSON)-serializing utf8 data fails.
$ ./manage.py dumpdata app --format=xml --indent=2 >app/fixtures/initial_data.xml
$ ./manage.py dumpdata auth sites --indent=2 >initial_data.json
$ ls -1 ../myproject/**/*initial_data*
../myproject/app/fixtures/initial_data.xml
../myproject/initial_data.json
$ ./manage.py flush
You have requested a flush of the database.
This will IRREVERSIBLY DESTROY all data currently in the database,
and return each table to the state it was in after syncdb.
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: yes
You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): no
Loading 'initial_data' fixtures...
Installing xml fixture 'initial_data' from '/path-to/myproject/app/fixtures'.
Installing json fixture 'initial_data' from absolute path.
Installed 72 object(s) from 2 fixture(s)
./manage.py test でも同様に読み込まれます。 Fixture はバックアップにも使えるし、 Django 0.97-pre では django.test.TestCase でも サポート されています。
