Generate Django test data from your models

Hand-written Django fixtures and factory_boy factories rot the moment you run a migration, and copying a production dump into your test suite is a GDPR problem waiting to happen. The fix: SeedBase reads your models.py and generates realistic, foreign-key-consistent data that actually looks real, not "Premium Widget 1" and lorem ipsum. One fixture seeds a whole test database, with pytest and pytest-django.

Realistic, foreign-key-consistent Django test data generated from models.py in SeedBase

Free tier, no card. Want to see the output before wiring anything up? Try the login-free sandbox: paste a schema, generate, look at the rows.

From models.py to a populated test database

A handful of Django fixtures is fine. A real project is not. Once you have dozens of models, every factory has to know which parent rows exist, which foreign keys to satisfy, and which derived totals to keep in sync. You end up maintaining a second, worse copy of your schema in test code, and it breaks on the next migration.

SeedBase reads your models.py instead. It walks the model graph, resolves the foreign keys, and fills a whole foreign-key-consistent database with realistic distributions. One generation, one fixture, and your test gets a database that looks like production without being production.

Seed a Django test database in pytest

A pytest fixture is just dependency injection: the test declares what it needs in its arguments and the framework provides it. So inject the whole database.

# tests/test_orders.py
def test_pagination(seeded_database):
    # a live connection to a DB full of realistic, FK-consistent data
    rows = seeded_database.execute(
        sqlalchemy.text("SELECT email FROM users LIMIT 5")
    ).fetchall()
    assert all("@" in e for (e,) in rows)

Install with pip install "seedbase[database]". The seeded_database fixture loads a generation into a live database and hands you the connection. Prefer no database at all? The seeded_rows fixture returns {table: [rows]} as an in-memory dict, so you assert against the rows directly. It plays alongside pytest-django, and it is an alternative to loaddata and factory_boy when you want a whole populated database rather than a handful of objects.

Reads real Django projects

Toy schemas are easy. The hard part is the patterns a real Django codebase actually uses, and that is what SeedBase was built against.

SeedBase was tested against a real 20-app Django project with 226 tables, including abstract mixins and ForeignKey("self"). That is where the foreign-key handling and the edge cases came from, not from a tidy three-table demo.

Deterministic and reproducible

Generation is seeded. The same seed produces the same data, every run. That keeps CI reproducible: the same fixture yields the same rows on every machine, so a green build stays green for the right reason. When a test fails, reuse the seed and you reproduce the exact dataset that broke it, instead of chasing a fixture that has since been hand-edited.

Free tier: generate, download, seed

Generation and JSON download are free to use. You do not need push-to-database or any paid feature to seed a Django test database, because the data loads through your own database connection or as plain rows in memory. Generate once, download the JSON, and let your fixture wire it into the test setup.

Honest note: the framework adapters are thin, the value is the engine behind them. SeedBase was tested against a real 20-app Django project with 226 tables, including abstract mixins and ForeignKey("self"), that is where the foreign-key and edge-case handling came from. EU-hosted, no third-party trackers, and you can export everything, so nothing is locked in.

Try it

There is a runnable example, so you can clone, run the test, and watch a real FK-consistent dataset get seeded into a Django test database. Then point it at your own models.

Stop hand-maintaining Django fixtures.

Generate a foreign-key-consistent dataset from your models.py once and seed it into your pytest tests. Free tier, no card.

Create a free account

Frequently asked questions

Is it free?

Yes. Generation and JSON download are part of the free tier, so you can pull a foreign-key-consistent dataset from your Django models and load it into your tests at no cost. Pro adds Parquet export, direct database push and higher row limits, but you do not need any of that to seed a Django test database.

How is this different from factory_boy or Faker?

factory_boy and Faker generate objects or values one field at a time and you still wire up every factory and relationship by hand. SeedBase reads your schema and fills a whole foreign-key-consistent database with realistic distributions, so an order that points at a customer actually has a customer to point at and the values look real instead of "Premium Widget 1" or lorem ipsum.

Does it read my models.py?

Yes. SeedBase reads a Django models.py including abstract mixins and model inheritance, ForeignKey("self") self-references, and implicit id primary keys. It also reads a SQL dump or a live database connection, so you can point it at whichever representation of the schema you already have.

Is it deterministic?

Yes. Generation is seeded, so the same seed produces the same data every run. That makes CI reproducible: the same fixture yields the same rows, and a failing test can be reproduced exactly by reusing the seed.

Does it work with pytest-django?

Yes. The seeded_database fixture loads a generation into a live database and hands your test a connection, and it plays alongside pytest-django. If you do not want a database at all, the seeded_rows fixture returns the data as an in-memory dict of table to list of rows. It is an alternative to loaddata and factory_boy for a whole populated database.