Skip to main content

Zero-config, whole-project database seeding for Django, powered by Mimesis.

Project description

django-data-seed

CI PyPI version Python versions Django versions License: MIT

Fill your entire Django database with realistic, valid test data — in one command, with zero configuration.

Every Django project hits the same wall: you need data to build against. So you click through the admin for twenty minutes, or hand-write fixtures, or maintain a factory for every single model — and you still end up with test test and a@a.com everywhere, which makes demos look fake and lets real bugs hide.

django-data-seed does it for you. Point it at your project and it reads your models, works out the right order to fill them, generates believable data that respects every field's rules, and bulk-inserts the lot — in seconds.

pip install django-data-seed
python manage.py seeddata --count 20 --seed 42
Pre-flight
  ✔ Database: postgresql (JSON ✓, bulk-returns-pk ✓)
  ✔ Migrations: all applied
  ✔ Schema: 14 models in sync
Seed plan — 20 rows per model
├── shop.Author
├── shop.Publisher
└── shop.Book
✨ 280 rows across 14 models in 0.4s (seed 42)

That's the whole thing. No factories, no fixtures, no configuration.


Features

Feature What it does for you
Zero-config generation Reads your models and fills every field type with a valid value — nothing to write.
Realistic values A column named city gets a real city, email a real address, price a believable amount — not lorem ipsum.
Correct relationships Seeds parents before children and reuses existing rows, instead of creating a fresh parent for every child.
Coherent rows A row makes sense with itself: created ≤ updated ≤ shipped dates, one person behind the name/email, one place behind the city/zip.
Reliable uniqueness Honours unique and unique_together / UniqueConstraint without hitting duplicate errors.
Pre-flight safety Refuses to run against a stale schema — it flags unapplied migrations or model drift before writing a row.
Bulk speed bulk_create, batched — a hundred thousand rows in seconds.
Reproducible --seed 42 produces the exact same data every run — for teammates, CI, and bug reports.
CLI and Python API Watch it run in the terminal, or call seed() from your scripts and tests.

Supported versions

Supported
Python 3.10, 3.11, 3.12, 3.13, 3.14
Django 4.0 → 6.0 (every release, including the 4.2 and 5.2 LTS)
Databases SQLite, PostgreSQL, MySQL / MariaDB, SQL Server

Every push is tested on GitHub Actions across Python 3.10–3.13 × Django 4.0–5.2 on SQLite, PostgreSQL, and MySQL — the CI badge above is the live proof.

Dependencies

Installing the package pulls in just three small runtime dependencies:

Package Why it's needed
Django >= 4.0 The framework the app plugs into.
mimesis >= 11 Generates the fake data — fast and locale-aware.
rich >= 13 Draws the progress bars and summary tables in the CLI.

Database drivers are optional extras, so you only install what you use:

pip install django-data-seed              # core — SQLite works out of the box
pip install django-data-seed[postgres]    # PostgreSQL (psycopg)
pip install django-data-seed[mysql]       # MySQL & MariaDB (mysqlclient)

How to configure it in your project

Three steps — that's the entire setup.

1. Install

pip install django-data-seed

2. Add it to INSTALLED_APPS

# settings.py
INSTALLED_APPS = [
    # ...
    "django_data_seed",
]

3. Seed

python manage.py seeddata --count 20 --seed 42

Using it

python manage.py seeddata                      # every model, 10 rows each
python manage.py seeddata shop.Book --count 50 # just one model
python manage.py seeddata --dry-run            # preview the plan, write nothing
python manage.py seeddata --locale de_DE       # localised data

Or from Python — handy in scripts and tests:

from django_data_seed import seed

seed("shop.Book", count=50, seed=42)   # reproducible
seed(count=25)                         # the whole project

📖 Full documentation

The README is the quick tour. For the complete guide — every CLI flag, the Python API, how foreign-key strategies and coherence work, custom overrides, and the 0.4 → 1.0 migration notes — see the docs:


License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any changes.

Support

For any issues or questions, open an issue on the GitHub repository.

Author

Rohith Baggam

LinkedIn · GitHub

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_data_seed-1.0.1.tar.gz (54.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_data_seed-1.0.1-py3-none-any.whl (52.1 kB view details)

Uploaded Python 3

File details

Details for the file django_data_seed-1.0.1.tar.gz.

File metadata

  • Download URL: django_data_seed-1.0.1.tar.gz
  • Upload date:
  • Size: 54.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for django_data_seed-1.0.1.tar.gz
Algorithm Hash digest
SHA256 f57b470d8549d403c503ecdcd561241edb0efb13f9b252869b0f898bc24a3262
MD5 902aa3474ed48bea6e72bb72587a9594
BLAKE2b-256 f6e77eff4e8bc11561033a9cc441c113780e9472adfbc5d50177d17a4476adb4

See more details on using hashes here.

File details

Details for the file django_data_seed-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_data_seed-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 84aaffd1b78bf1170b346f5ccee76f2ed51d789264038cf8a8a6e8924b64df0b
MD5 7b0be725aa6cb2c0b2698fec76cb82d6
BLAKE2b-256 c2570f47bd2d68e79c1c871cac6109b22f886f7a3e5bc514df02e03b369b8e68

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page