django dumpdata empty array
I also had the same issue, you need to specify the correct database. For example, given your code:
$ ./manage.py dumpdata --database=auth_db account
- Make sure the model goes correct. if the model has an error, the
./manage.py dumpdata
command will keep silent while running and output[]
. So the suggestion is to run the models' code in./manage.py shell
and the target data exists, for example:
from account.models import Account
print Account.objects.all()[:1]
- Make sure
./manage.py dumpdata
can find the targe model. Django finds models via{APP_NAME}.models
, if you place your models in directoryaccount/models/
, import your models inaccount/models/__init__.py
, for example:from profile import Profile