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?
python manage.py loaddata myapp/fixtures/initial_data.json
you need to pass the file name with full path
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With