I have this JSON file called data.json
which is saved in my /fixtures folder. I cannot load my data into a model as I enter python manage.py loaddata data.json
, I get this error.
I have made sure the file is in the proper JSON format but I can’t figure out what is causing this error.
Traceback (most recent call last):
File "/home/msd/.local/lib/python3.6/site-packages/django/core/serializers/json.py", line 69, in Deserializer
yield from PythonDeserializer(objects, **options)
File "/home/msd/.local/lib/python3.6/site-packages/django/core/serializers/python.py", line 91, in Deserializer
Model = _get_model(d["model"])
KeyError: 'model'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/home/msd/.local/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/home/msd/.local/lib/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/msd/.local/lib/python3.6/site-packages/django/core/management/base.py", line 328, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/msd/.local/lib/python3.6/site-packages/django/core/management/base.py", line 369, in execute
output = self.handle(*args, **options)
File "/home/msd/.local/lib/python3.6/site-packages/django/core/management/commands/loaddata.py", line 72, in handle
self.loaddata(fixture_labels)
File "/home/msd/.local/lib/python3.6/site-packages/django/core/management/commands/loaddata.py", line 114, in loaddata
self.load_label(fixture_label)
File "/home/msd/.local/lib/python3.6/site-packages/django/core/management/commands/loaddata.py", line 172, in load_label
for obj in objects:
File "/home/msd/.local/lib/python3.6/site-packages/django/core/serializers/json.py", line 73, in Deserializer
raise DeserializationError() from exc
django.core.serializers.base.DeserializationError: Problem installing fixture '/home/msd/Projects/Django/markets/fixtures/data.json':