IntegrityError when loading fixture during django testing

后端 未结 2 1616
攒了一身酷
攒了一身酷 2020-12-14 01:59

I\'m loading a fixture created with dumpdata, and getting the following exception:

Problem installing fixture \'db_dump.json\': Traceback (most recent call l         


        
2条回答
  •  既然无缘
    2020-12-14 02:30

    Apparently one of the traps for the unwary is that one must exclude contenttypes when exporting fixtures. (Thanks to subsume on #django for the information).

    To exclude content types use the -e option when running the dumpdata command.

    $./manage.py dumpdata -e contenttypes > initial_data.json
    

提交回复
热议问题