Skip to content

Instantly share code, notes, and snippets.

@n37r06u3
Forked from trey/django_fixtures.md
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n37r06u3/010d9bb28e1aa11b0612 to your computer and use it in GitHub Desktop.
Save n37r06u3/010d9bb28e1aa11b0612 to your computer and use it in GitHub Desktop.

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

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