django fixtures: load multiple fixtures on syncdb
Question
I have a lot of things in my initial_data.json right now. I wondered if there is a way to split the data in files (by model) so that all of the files are loaded via same manage syncdb command?
I recently revisited the problem, and came up with a better way of hooking code to 'real' post_syncdb signal:
Solution
Yes, syncdb will load everything from your app/sql/modelname.sql on syncdb once for each model file - that's not exactly json though, only pure SQL can go there.
If you want to split your json fixtures you have to name them something like mymodel.json, put it inside app/fixtures/, and do manage.py loaddata mymodel manually after syncdb
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow