Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CommandError: No fixture named 'myapp' found

Tags:

django

I created a json file myapp/fixtures/initial_data.json , which has the data to be loaded.

But when I run

python manage.py loaddata myapp

Getting below error

CommandError: No fixture named 'myapp' found.

What could be reason for the error?

like image 531
user866933 Avatar asked Jul 18 '17 11:07

user866933


2 Answers

python manage.py loaddata myapp/fixtures/initial_data.json 

you need to pass the file name with full path

like image 115
Exprator Avatar answered Oct 17 '22 20:10

Exprator


python manage.py loaddata should be followed by fixture name, not app name.

So instead of typing: python manage.py loaddata myapp

you should type python manage.py loaddata initial_data or python manage.py loaddata initial_data.json (Of course full path is fine too if you don't mind the long string.)

For more information, please check the official document.

like image 3
Ferro Fang Avatar answered Oct 17 '22 20:10

Ferro Fang