Django fixtures: initial data for models
Answer: You can provide initial data with migrations or fixtures when you first set up an app. A data migration can load initial data automatically. Fixtures are another way to prepopulate the database with hard-coded data.
Notes
Migrations are run when setting up the test database, so migration-loaded data is available there, subject to some limitations. Fixtures are useful for hard-coded data, but a data migration is the usual way to load initial data for an app automatically.
Reference list
Youcan provide initial data with migrations or fixtures.Prepopulatethe database with hard-coded data when first setting up an app.Createa data migration to load initial data automatically.
See also
Claims
- id: C1 claim: You can provide initial data with migrations or fixtures. source: S1 evidence: "You can provide initial data with migrations or fixtures"
- id: C2 claim: Prepopulate the database with hard-coded data when first setting up an app. source: S2 evidence: "prepopulate your database with hard-coded data"
- id: C3 claim: Create a data migration to load initial data automatically. source: S2 evidence: "To automatically load initial data for an app, create a :ref:`data migration"
Sources
- [S1] How to provide initial data for models. Django docs. https://docs.djangoproject.com/en/5.2/howto/initial-data/ . License: BSD-3-Clause. Accessed 2026-11-18.
- [S2] initial-data.txt. Django. https://raw.githubusercontent.com/django/django/stable/5.2.x/docs/howto/initial-data.txt . License: BSD-3-Clause. Accessed 2026-11-18.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Django docs, How to provide initial data for models; Django, initial-data.txt. BSD-3-Clause (https://raw.githubusercontent.com/django/django/main/LICENSE). Copyright Django Software Foundation and individual contributors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Django docs, How to provide initial data for models; Django, initial-data.txt. BSD-3-Clause (https://raw.githubusercontent.com/django/django/main/LICENSE). Copyright Django Software Foundation and individual contributors.
Cite this
iinventedlight. 2026. "Django fixtures: initial data for models." iinventedlight Library, iil:note:7e2ckjtz, version of 2026-11-18. https://iinventedlight.com/library/notes/django-fixtures/. License: CC-BY-4.0.
@misc{iil_note_7e2ckjtz,
author = {{iinventedlight}},
title = {{Django fixtures: initial data for models}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/django-fixtures/},
note = {Permanent ID iil:note:7e2ckjtz. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- django-fixtures.table.json (table; CC-BY-4.0)
- django-fixtures.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/django-fixtures.md.