Django: Getting Started Transcripts
Chapter: Django ORM and Databases
Lecture: Associating data fixtures with a Django app

Login or purchase this course to watch this video and the rest of the course contents.
0:00 You can also associate fixture files with an app. By doing so, you can load data based on the app name rather than on a file name.
0:09 This can be helpful if you're creating a shipable third party app that requires some data associated with the models.
0:15 Let me just set this up so that I can demonstrate. First off, I need to create a fixture directory.
0:26 Then I'll take the catalog JSON file created by dump data and move it inside the fixtures directory.
0:37 Now back to the terminal to wipe everything out and show you the magic. Back in Ashland, wipe the database once again, migrated, and ran the load data.
0:58 Similar to before, but this time I'm specifying the catalog app name instead of the file name. This can also be a nice shortcut.
1:06 If your app happens to have multiple fixture files, they can all be loaded at once. If they're in the right place.


Talk Python's Mastodon Michael Kennedy's Mastodon