Skip to content

Instantly share code, notes, and snippets.

@trey
Created May 28, 2012 11:50
Show Gist options
  • Save trey/2818751 to your computer and use it in GitHub Desktop.
Save trey/2818751 to your computer and use it in GitHub Desktop.
Use Django Fixtures to Automatically Load Data when You Install an App

Use Django Fixtures to Automatically Load Data when You Install an App

First, load some data via the admin that should always be there when someone installs the app.

Next, dump that data out into JSON format into a fixture:

$ ./manage.py dumpdata [app_name] > [app_name]/fixtures/initial_data.json

Now whenever someone installs the app and runs syncdb, they'll get that initial data loaded into their database.

Sources

@trey
Copy link
Author

trey commented May 28, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment