loaddata - Django 1.6.5 - Unable to load initial data from fixtures -
i tried load initial-data suggested in djangoproject. couldn't able load object on database. when tried load data, says
> python manage.py loaddata ./fixtures/initial_data.json installed 0 object(s) 0 fixture(s)
but have data on 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 django.db import models class person(models.model): name = models.charfield(max_length=100, verbose_name="full name")
i tried ./manage.py loaddata pwd
/tabletest/fixtures/initial_data.json not succeed. please me suggest have missed.
this issue arises because write definition model @ project directory instead of app directory , table defined on model not created on running syncdb
. later create app , move fixtures, models.py,views.py app directory, rewrite urls.py. data loaded successfully.
Comments
Post a Comment