Skip to main content

django-schematic

Latest on Django Packages PyPI version PyPI downloads Python versions License Python Tests UI Tests TypeScript React Vite React Flow d3-force dagre ELK

If this is useful to you, a star helps others find it.

Interactive schema visualization for Django projects.

See all your models, fields, and relationships as an interactive, force-directed graph — directly in your browser. Zero Node.js required at runtime.

Features

  • Export/Import view state as a PNG with location/canvas placement data.
  • Export/Import view state as JSON
  • Clean JSON API endpoint (GET /schema/api/)
  • Force-directed layout with physics settle animation (drag-to-pin support)
  • Hierarchical layout via dagre
  • Click to expand/collapse field lists per model
  • App-based color coding
  • Show/hide models and apps via sidebar
  • Django 5.x + Python 3.12+ only

Live Demo

Visualize

output

Frontend Stack

Aspect Technology
Framework React 18
Language TypeScript
Graph Visualization React Flow (@xyflow/react 12)
Layout Engines d3-force + dagre + ELK (3 options)
UI / Styling TailwindCSS 4
State Management Zustand 5
Bundler Vite 6
Type Safety Full TypeScript
Testing Vitest + ESLint
CDN Dependencies None (all bundled)
Package Manager npm

Exported PNG file with embedded config data

This is an example output PNG file, that can be re-imported into django-schematic

schematic2-900

Quick Start

pip install django-schematic

Add to INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    "schematic",
]

Add to urls.py:

from django.urls import include, path

urlpatterns = [
    ...
    path("schema/", include("schematic.urls")),
]

Visit http://localhost:8000/schema/ — your model graph will be there.

Security

The viewer is only accessible when DEBUG = True. In production (DEBUG = False) both the HTML view and the API return 404, making the URL appear non-existent.

To expose the viewer in production behind your own auth layer, set the visible option to a callable:

SCHEMATIC = {
    "visible": lambda request: request.user.is_staff,
}

Configuration

# settings.py (all optional — these are the defaults)
SCHEMATIC = {
    "visible": lambda request: settings.DEBUG,  # or any callable, or True/False
    "include_apps": [],           # empty = all apps
    "exclude_apps": ["admin", "contenttypes", "sessions", "auth"],
    "exclude_models": {},         # {"myapp": ["InternalModel"]}
    "include_abstract": False,
    "include_proxy": True,
    "suppress_through_m2m": False,
}

suppress_through_m2m

When a ManyToManyField uses an explicit through model, Django draws two layers of relationships: the FK edges from the through table to each side, and a direct logical M2M edge on the model that declares the field. With suppress_through_m2m = False (the default) both are shown.

Set suppress_through_m2m = True to hide the redundant logical M2M edge and keep only the FK edges through the junction table — useful when the through model carries extra fields and you want the graph to reflect the true database structure.

Explicit through models are also tagged through in the graph and shown with a through badge in the node header, making them easy to identify regardless of this setting.

API

The schema is also available as JSON:

GET /schema/api/
GET /schema/api/?apps=myapp,otherapp

CI/CD Pipeline (optional)

update_diagrams is a management command that re-renders your PNG schema diagrams automatically when models change. See README.setting-up-CI.md for setup instructions.

Development

# Backend
pip install -e ".[dev]"
pytest

# Frontend
cd ui
npm install
npm run dev   # Vite dev server with HMR
npm run build # Outputs to schematic/static/schematic/

License

MIT

Download files

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

Source Distribution

django_schematic-1.3.15.tar.gz (101.1 kB view details)

Uploaded Source

Built Distribution

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

django_schematic-1.3.15-py3-none-any.whl (617.8 kB view details)

Uploaded Python 3

File details

Details for the file django_schematic-1.3.15.tar.gz.

File metadata

  • Download URL: django_schematic-1.3.15.tar.gz
  • Upload date:
  • Size: 101.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for django_schematic-1.3.15.tar.gz
Algorithm Hash digest
SHA256 a0a2468ad42270245546266e2776a3da1d4a7a743d92e1fa8700bef82def3884
MD5 5a41a47f8a4de2b2bc7e4cdb6914e118
BLAKE2b-256 68e7444fa0cf20512fbe4568c91a4826748e0b46f43377493cf7e6e0a3b4fd51

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_schematic-1.3.15.tar.gz:

Publisher: release.yml on jsheffie/django-schematic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_schematic-1.3.15-py3-none-any.whl.

File metadata

File hashes

Hashes for django_schematic-1.3.15-py3-none-any.whl
Algorithm Hash digest
SHA256 0f7ac2a64b0b4d438361a76b356a0c8d1d59d7ea556ce3cd186dfb980efc6783
MD5 5ad358769a54d2b77555425bf5f7a677
BLAKE2b-256 e84123fa672fe015fea58765092004c39d5b21398b99ceba6e252da095909215

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_schematic-1.3.15-py3-none-any.whl:

Publisher: release.yml on jsheffie/django-schematic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.3.15 This release

2 files

1.3.14

2 files

1.3.13

2 files

1.3.12

2 files

1.3.11

2 files

1.3.10

2 files

1.3.8

2 files

1.3.7

2 files

1.3.6

2 files

1.3.5

2 files

1.3.4

2 files

1.3.3

2 files

1.3.2

2 files

1.3.1

2 files

1.3.0

2 files

1.2.0

2 files

1.1.0

2 files

1.0.9

2 files

1.0.8

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

0.3.6

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page