Is it possible to generate a diagram of an entire Django webapp?


Question

Is it possible to generate a diagram of an entire Django site? For example, to understand the model/database structure I use graphViz which is extremely useful for keeping track of the model structure, and very useful for discussions.

I was curious if something similar existed for the complete Django site so that urls/models/views/templates could all be represented graphically. I don't quite know what that would look like but am curious if any tool exists to do this.

This would programmatically generate a diagram showing the code flow between different parts of the site.

1
30
8/21/2017 3:12:28 PM

You can use django-extensions app for generating model visualisations.

setting.py

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    '...',

    'django_extensions',
    'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
)

Give this command in terminal

python manage.py graph_models -a -o myapp_models.png

This will generate a png file named myapp_models.png. It will have visualised image of the models. More documentation can be found here.

21
2/5/2015 1:50:56 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon