1

我创建了一个 json 固定装置,并将其放在我的 myapp/fixtures/ 中。我已将 myapp/fixtures 添加到 settings.FIXTURE_DIRS。这是我尝试加载夹具的输出:

jeff@jeff-linux:~/myapp$ ./manage.py loaddata --verbosity=2 default.json
Loading 'default' fixtures...
[...truncated checking default paths and installed apps/fixtures...]
Checking '/home/jeff/myapp/fixtures/' for fixtures...
Trying '/home/jeff/myapp/fixtures/' for default.json fixture 'default'...
No json fixture 'default' in '/home/jeff/myapp/fixtures/'.
Trying '/home/jeff/myapp/fixtures/' for default.json.gz fixture 'default'...
No json fixture 'default' in '/home/jeff/myapp/fixtures/'.
Trying '/home/jeff/myapp/fixtures/' for default.json.zip fixture 'default'...
No json fixture 'default' in '/home/jeff/myapp/fixtures/'.
Trying '/home/jeff/myapp/fixtures/' for default.json.bz2 fixture 'default'...
No json fixture 'default' in '/home/jeff/myapp/fixtures/'.
Checking absolute path for fixtures...
Trying absolute path for default.json fixture 'default'...
No json fixture 'default' in absolute path.
Trying absolute path for default.json.gz fixture 'default'...
No json fixture 'default' in absolute path.
Trying absolute path for default.json.zip fixture 'default'...
No json fixture 'default' in absolute path.
Trying absolute path for default.json.bz2 fixture 'default'...
No json fixture 'default' in absolute path.
No fixtures found.
jeff@jeff-linux:~/myapp$ ls fixtures/
defaults.json  moneytrail.json

这是 default.json 中的内容: [ { "pk": 1, "model": "myapp.feature", "fields": { "default_feature": "0.25" } } ]

我在这里遗漏了一些明显的东西吗?我已经尝试将 FIXTURE_DIRS 作为固定装置和固定装置/相同的结果。

谢谢。

4

1 回答 1

13

你的文件:defaults.json

您的命令行参数:default.json

仔细看。

于 2009-09-24T02:23:51.830 回答