skip to Main Content

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


  1. Chosen as BEST ANSWER

    There was also a problem with the encoding. The encoding on the file was UTF-16, not UTF-8. It was converted using Notepad++


  2. 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.

    Login or Signup to reply.
    1. rename categories.js to categories.json
    2. run python manage.py loaddata fixtures/goods/categories.json
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search