Home

May 4, 2017, 1 min read

Visualize Django Models

The django-extensions contain a great command to visualize the model hierarchy of a Django project:

$ apt-get install graphviz
$ pip install pygraphviz
$ pip install django-extensions
# In your Django settings
INSTALLED_APPS = [
    "django_extensions",
]

Then you can get a zoomable vector graphic from all models of one app like so:

$ python manage.py graph_models my_app -o my_app_models.svg

The result may look like below, but make sure to explore the command options, it can be customized alot especially when you want to limit which models to draw.

payshare_models