CommandError: No fixture named 'fixture' found

847 Views Asked by At

I'm trying to use loaddata to load some fixtures into a Django 2.2.10 project. According to the documentation, the command should look like this:

python manage.py loaddata fixture app/fixtures/*.json

However, when I run this command I get the following error:

CommandError: No fixture named 'fixture' found.

I figured the word "fixture" was being interpreted as a path to the fixture, so I removed it and it worked:

python manage.py loaddata app/fixtures/*.json

I still find it weird though that the documentation tells me to do something that doesn't work. Am I missing something? I'm worried that I might have something wrong in my setup that is going to come back to haunt me in the future.

1

There are 1 best solutions below

2
monim On

to run fixtures in django. you should follow this syntax:

python manage.py loaddata fixture_name

not :

python manage.py loaddata fixture fixture_name

In your case you should run python manage.py loaddata app/fixtures/*.json

instead of python manage.py loaddata fixture app/fixtures/*.json because fixture here will be treated as fixture_name and it is not .