Skip to main content

DjangoVista logo

DjangoVista

A local, live, interactive diagram of your Django models, built from source without running your project.

PyPI version Checks Python 3.12+ MIT license

DjangoVista diagram showing Django model cards connected by labeled ForeignKey relations, including a custom user model

DjangoVista reads your Python source with the ast module, builds a graph of your Django models and serves it as a diagram in your browser. The diagram updates when you save a model file. Standalone scanning never imports your code, starts Django or connects to a database, so it works on projects you cannot fully run locally.

Alpha software. The graph format, API and UI may change between releases. See Limitations.

Contents: Quick start · Features · Execution boundaries · Editing fields · Migration status · manage.py · Python library · Limitations · Development · Roadmap · Contributing

Quick start

Requires Python 3.12 or newer. The released package bundles the web UI, so Node.js is not needed.

pip install django-vista
django-vista serve /absolute/path/to/your/django-project

The server starts on http://127.0.0.1:8000 and opens the diagram in your browser. Use --port 8001 if port 8000 is taken (a local runserver often uses it) and --no-browser to only print the URL.

Export the same graph as JSON without starting a server:

django-vista graph /absolute/path/to/your/django-project --output graph.json

Features

  • Source-based analysis. Module-qualified model identities, import aliases, re-exports and split models/ packages.
  • Fields and keys. Field types and options, nullability, uniqueness, primary and composite keys.
  • Relationships. ForeignKey, OneToOneField, ManyToManyField, explicit through models and settings.AUTH_USER_MODEL, including custom user models.
  • Inheritance. Abstract, proxy and multi-table models with parent links.
  • Diagnostics. Anything that cannot be resolved statically is reported with file and line. DjangoVista does not guess unresolved targets.
  • Interactive diagram. Automatic layout, search, filtering by app, minimap, zoom and draggable nodes whose positions survive updates.
  • Live updates. Source changes are detected by polling (1 second, 0.2 second debounce) and pushed to the browser as WebSocket snapshots.
  • Local API and library. The same graph is available as JSON, over HTTP and as a Python function.
  • Field editing with diff preview and stale-file protection (details).
  • Migration status as an explicit, opt-in runtime check (details).

Execution boundaries

DjangoVista has three behaviors with different effects. Only the first runs by default.

Operation Runs your project code? Touches your database? Writes files?
Static scan (django-vista serve, django-vista graph, the library) No No No
python manage.py showmodels Django loads your installed apps Not by DjangoVista No
Migration status (button in the UI) Yes, runs manage.py commands Reads migration history No

Field edits are a separate action: they write to a model file only when you press Apply.

  • Static scan: reads .py files as text and parses them. Virtual environments, migrations, caches, build directories and symlinks are skipped.
  • showmodels: Django initializes your configured apps for any management command. DjangoVista's own scan afterwards is still static.
  • Migration status: see below. It never runs by itself.

The server binds to 127.0.0.1 and is intended for local use. Editing and migration endpoints reject requests from non-local origins. Do not expose the server to a network.

Editing fields

Double-click a model to open the field editor. You can add standard scalar fields and change null, blank, unique and length or decimal parameters of declared fields.

  1. Preview shows a unified diff of the change.
  2. Apply writes the model file.

A file revision check rejects a preview if the file changed in the meantime. Existing methods, comments, imports and unrelated field arguments are preserved, and project expressions are never executed. Renaming or deleting fields, changing field types, editing relationships and creating models are not implemented.

Migration status

Runtime operation. Unlike the diagram, this check runs your project's Django code and reads migration history from its default database. It only runs when you click Check migrations.

Open Migration status in the sidebar, enter your project's absolute Python interpreter path (or let DjangoVista detect .venv or venv; it falls back to the server's Python) and click Check migrations. The opened directory must contain manage.py.

The panel runs makemigrations --dry-run to report model changes without a migration, and showmigrations --plan to list applied and pending migrations. It does not create migration files or apply migrations: run the displayed makemigrations and migrate commands in your own terminal, then check again.

Checks are manual, and a source change marks the last result as stale. Database errors are shown as errors, not as an up-to-date status. Each command has a 20-second timeout.

manage.py integration

To open DjangoVista from your project's terminal, install it into the same environment as your project with the Django extra, then add it to INSTALLED_APPS:

pip install "django-vista[django]"
INSTALLED_APPS = [
    # your apps ...
    "django_vista",
]
python manage.py showmodels
python manage.py showmodels --port 8001
python manage.py showmodels --no-browser
python manage.py showmodels --project /path/to/project

The command serves the diagram until you press Ctrl+C. It uses the directory containing manage.py, falling back to BASE_DIR for programmatic invocation. Django loads your installed apps when it runs any management command; the diagram scan itself remains static. Startup does not run migration checks.

Python library

from pathlib import Path
from django_vista import build_graph

graph = build_graph(Path("/absolute/path/to/your/django-project"))
print(graph.model_dump_json(indent=2))

build_graph returns a Pydantic model with nodes, edges and diagnostics. See the graph contract for exact semantics, including the HTTP and WebSocket protocol.

Limitations

Static analysis cannot reproduce arbitrary Django runtime behavior.

  • Dynamically generated models or fields, conditional definitions, wildcard imports and models defined only in unscanned dependencies are not supported.
  • Custom field classes are reported as unsupported. Fields inherited from Django's own AbstractUser, AbstractBaseUser and PermissionsMixin are not displayed.
  • AUTH_USER_MODEL is read from a literal assignment in scanned source. If it is missing or defined inconsistently, relations to the user model stay unresolved.
  • Implicit id fields use a placeholder AutoField because DEFAULT_AUTO_FIELD is not evaluated.
  • Abstract models are shown for context; inherited storage is represented through parent links.
  • Every update rescans the project and sends a full snapshot. Large projects have not been benchmarked.
  • Release validation is incomplete: browser acceptance and cross-platform wheel checks remain. See validation results.

Development

Install from source

Building the UI from source needs Python 3.12+ and Node.js 24+. Released wheels do not.

git clone https://github.com/Jamshid057/Django-Vista.git
cd Django-Vista
python3 -m venv .venv
source .venv/bin/activate        # Windows: .venv\Scripts\activate
python -m pip install --upgrade pip
python scripts/build_release.py --bundle-only
python -m pip install .
django-vista serve /absolute/path/to/your/django-project

Run backend and frontend separately

python -m pip install -e .
python -m uvicorn django_vista.main:app --reload

In a second terminal:

cd frontend
npm ci
npm run dev

Open http://localhost:5173 and enter a project directory. The Vite dev server uses http://127.0.0.1:8000 as its API by default; set VITE_API_URL to change it (see frontend/.env.example). The bundled UI connects to its own origin. examples/sample_project contains parser fixtures for a demo. It is not a runnable Django project and does not need Django installed.

Tests and validation

PYTHONPATH=backend python -m unittest discover -s backend/tests -v
cd frontend
npm run test
npm run build
npm run lint

Backend tests cover parser behavior and in-process HTTP, WebSocket and watcher lifecycle. CI runs these checks, builds the wheel and smoke-tests the installed package on Python 3.12 and Node 24. Parser changes should come with a small source fixture that asserts resolved edges and diagnostics.

Build a release

python -m pip install build
python scripts/build_release.py

The script builds the frontend, copies it into the Python package and produces a wheel and source archive in dist/. Use --skip-install when frontend dependencies are already installed. Generated UI and build output are not committed.

Naming

Surface Name
Project DjangoVista
PyPI distribution, repository and terminal command django-vista
Python import and Django app django_vista

The source lives in backend/app/; setuptools installs it as django_vista.

Roadmap

Planned, not implemented:

  • A VS Code extension that starts the local server and shows the diagram in an editor panel.
  • A PyCharm integration after the VS Code extension.
  • Field rename, delete and type changes, relationship editing and model creation.
  • Incremental parsing, if measurements show it is needed.

See the distribution roadmap and the historical implementation plan.

Contributing

Bug reports, documentation fixes and focused pull requests are welcome. Please read CONTRIBUTING.md first, and report problems through GitHub Issues. For connecting a local checkout to a remote, see the Git setup guide.

License

Released under the MIT License.

Metadata

Release files for django-vista 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-vista 0.1.1
File Size Uploaded Provenance Actions
django_vista-0.1.1.tar.gz 667.8 kB With provenance Details for django_vista-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-vista 0.1.1
File Interpreter ABI Platform Actions
django_vista-0.1.1-py3-none-any.whl Python 3 none any Details for django_vista-0.1.1-py3-none-any.whl

Total release size: 1.3 MB

Release files / django_vista-0.1.1.tar.gz

Download URL django_vista-0.1.1.tar.gz
Size 667.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4f5603679485fa4293fab12d5c3d390e3467539ec94324fb24b2e5da646cbf01
BLAKE2b-256 checksum
How to use checksums
76c9614c7ad9cbfbccca87450b56af5747ad0b1e80d3d994d483be56f41904f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / django_vista-0.1.1-py3-none-any.whl

Download URL django_vista-0.1.1-py3-none-any.whl
Size 611.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31eca0b20ba4e78494194b35b71cf84d65e96fc5b4f930da46a1f2891bd5568c
BLAKE2b-256 checksum
How to use checksums
2906ef560904faf3c04d5ad4b20676385b0f8202960c21511ce337ab35c08d96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Security for django-vista 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_vista-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

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