Skip to content

pikhovkin/django-schema-viewer

Repository files navigation

django-schema-viewer

GitHub Actions badge PyPI - Version PyPI - Python Version PyPI - Django Version PyPI - License

framework - Django Hatch project Ruff

Buy me a coffee Support me Patreon Liberapay

Visualizes a DB schema based on Django models.

django-schema-viewer demo

Installation

pip install django-schema-viewer

Usage

  1. Install the package

  2. Add schema_viewer to your INSTALLED_APPS settings like this:

INSTALLED_APPS = [
    ...,
    'schema_viewer',
    ...,
]
  1. Add schema_viewer.urls to main urls.py:
from django.urls import path, include

urlpatterns = [
    ...,
    path('schema-viewer/', include('schema_viewer.urls')),
    ...,
]
  1. Run the project
python manange.py runserver
  1. Go to http://127.0.0.1:8000/schema-viewer/

Optional settings

SCHEMA_VIEWER = {
    'apps': [
        'contenttypes',
        'my_app',
    ],
    'exclude': {
        'auth': ['User'],
        'my_app': ['SomeModel'],
    },
}

License

MIT