In Django I have folder with fixturesgoodscategories.js
and fixturesgoodsproducts.js
. I installed PostgreSQL and I have tables categories
and products
. But when I write python manage.py loaddata fixtures/goods/categories.json
I get the error: CommandError: No fixture named 'categories' found.
How do I load fixtures? This may be due to the fact that I may have previously loaded everything into something other than the environment. That is, I did python manage.py dumpdata
not in the environment…
3
Answers
There was also a problem with the encoding. The encoding on the file was UTF-16, not UTF-8. It was converted using Notepad++
As @AKX says in their comment, you you use
.json
files, not.js
. JSON is a (very) strict subset of JavaScript that only allows to write data objects, no loops, variables, conditions, etc..js
would imply you have a JavaScript file.This is also what the Django error says, it can not find
categories.json
, not.categories.js
python manage.py loaddata fixtures/goods/categories.json