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

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

$ python 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.

1 Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.