django-schema-viewer

raw JSON →
0.5.3 verified Fri May 01 auth: no python

django-schema-viewer visualizes a database schema based on Django models. It generates interactive ER diagrams using D3.js. Current version 0.5.3, weekly releases.

pip install django-schema-viewer
error ImportError: cannot import name 'schema_view' from 'django_schema_viewer'
cause Version mismatch. Used old import path or older version.
fix
Run 'pip install --upgrade django-schema-viewer' and use 'from django_schema_viewer import schema_view'.
error ModuleNotFoundError: No module named 'graphviz'
cause The graphviz Python package or system binaries are missing.
fix
Run 'pip install graphviz' and also install Graphviz system package (e.g., 'apt install graphviz' on Ubuntu).
error AttributeError: 'AppConfig' object has no attribute 'models_module'
cause Unsupported Django or app configuration issue.
fix
Ensure Django >=3.1 and check app configuration. Try removing cached .pyc files.
breaking In version 0.5.0, the main view was moved from django_schema_viewer.views to django_schema_viewer. If you imported from the old path, you'll get ImportError.
fix Change import to 'from django_schema_viewer import schema_view'.
deprecated The management command 'dump_schema' was deprecated in 0.5.0 and will be removed in a future release.
fix Use the 'generate_schema' command instead (if available) or rely on the view.
gotcha The schema only shows models from installed apps. Make sure your app is in INSTALLED_APPS or models will be missing.
fix Verify your app is listed in Django's INSTALLED_APPS.

Add the schema_view to your Django URL config and visit /schema/ to see the diagram.

from django_schema_viewer import schema_view
from django.urls import path

urlpatterns = [
    path('schema/', schema_view),
]