django-graphviz


django + graphviz

Overview

http://djangodev.free.fr/django-graphviz/djangographviz.gif

Django data visualization with graphviz.

http://djangodev.free.fr/django-graphviz/django-graphviz.png

The django_graphviz django project provides 2 applications: * graphviz: the main component, embeddable in any project * testapp: a sample application

Example

The models of the testapp application:

http://djangodev.free.fr/django-graphviz/testapp.dot.png

A typical diagram that may be generated:

http://djangodev.free.fr/django-graphviz/main.dot.png

How to ?

  • add the graphviz application to your django project
  • set the GRAPHVIZ_DOT_CMD setting with the absolute path of the 'dot' command
  • add a line like (r'^graphviz/', include('graphviz.urls')), in the main urls.py file
  • add some methods to your data models; you can find the specifications in the graphviz/interfaces.py; the objects that implements those interfaces may be either django models or simple classes; take a look at the sample application, specially the file testapp/models.py
  • instantiate a Graph object; you just have to give a "root" object that implements the IGraph interface
  • you may customize the graph by adding some ArrowVisual and NodeVisual instances
  • that's all: you can now download a dot file or an image from the Graph admin page.

Commands

Moreover, the_graphviz_application provides the_modelviz_command that generates a dot file describing models._

Usage: python manage.py modelviz app1 '['app2 ...']' > diagram.dot

The command python manage.py modelviz graphviz generates a UML-like diagram of the graphviz django component:

http://djangodev.free.fr/django-graphviz/graphviz.dot.png

The command python manage.py modelviz testapp generates a UML-like diagram of the sample testapp application:

http://djangodev.free.fr/django-graphviz/testapp.dot.png

Project Information

Labels:
django graphviz python