mumbleapi
mumbleapi copied to clipboard
Getting Foreign Key constraint failed error while running loaddata command
HI, I am getting this below error while loading the test JSON data using the command python manage.py loaddata articledata.json
ERROR:- raise dj_exc_value.with_traceback(traceback) from exc_value File "D:\Programming\Django\mumbleapi\env\lib\site-packages\django\db\backends\base\base.py", line 242, in _commit return self.connection.commit() django.db.utils.IntegrityError: FOREIGN KEY constraint failed
Please look into the issue. Also explain the problem due to which it occurs.
did you created the superuser first ?
did you created the superuser first ?
Yes, I followed the exact steps as it is there.
did you created the superuser first ?
fetchdata.json file loaded smoothly but for the next two data, I am facing the same foreign key constraint error.
okay ! let me see
Same issue but I get it only when running "python manage.py loaddata discussiondata.json"
The error seems to be caused by the tags
field for some reason. Removing the tags
from the discussiondata.json
file solved the problem for me.