我尝试按照djangoproject中的建议加载初始数据。但我无法在我的数据库上加载对象。但是当我尝试加载数据时,它总是说
> python manage.py loaddata ./fixtures/initial_data.json
Installed 0 object(s) from 0 fixture(s)
但我有关于 initial_data.json [/test-project/tableTest/tableTest/fixtures/initial_data.json] 的数据
[
{
"model":"tableTest.person",
"pk":1,
"fields": {
"name":"Kevin"
}
},
{
"model":"tableTest.person",
"pk":2,
"fields": {
"name":"Harry"
}
},
{
"model":"tableTest.person",
"pk":3,
"fields": {
"name":"Piter"
}
}
]
#models.py
from django.db import models
class Person(models.Model):
name = models.CharField(max_length=100, verbose_name="full name")
我也试过./manage.py loaddata pwd
/tableTest/fixtures/initial_data.json但未能成功。请帮我建议我错过了什么。