10

I am looking for a way to generate UML diagrams from a Django application Model structure.

Epydoc doesn't work with Django models because it needs django's settings.py to be imported and manage.py graph_models generates unreadable output, not easily parsable and hard to convert to UML.

Is there any tool avaialble to do that?

pistache
  • 5,782
  • 1
  • 29
  • 50
Bite code
  • 578,959
  • 113
  • 301
  • 329
  • I've started working on [app called django-spaghetti-and-meatballs that produces interactive HTML entity-relationship diagrams from django model definitions](https://github.com/LegoStormtroopr/django-spaghetti-and-meatballs/), like this i.stack.imgur.com/lvxSG.png –  Aug 22 '15 at 03:56
  • possible duplicate of [Django - Model graphic representation (ERD)](http://stackoverflow.com/questions/6776592/django-model-graphic-representation-erd) –  Aug 22 '15 at 04:00
  • Have you found anything better than graph_models ? – Cristiano Coelho Nov 04 '15 at 01:37

2 Answers2

3

There is a graph tool in django_extensions app. Precisely this one http://code.google.com/p/django-command-extensions/wiki/GraphModels

# Create a PNG image file called my_project_visualized.png with application grouping
$ ./manage.py graph_models -a -g -o my_project_visualized.png
Frost.baka
  • 7,851
  • 2
  • 22
  • 18
1

pyreverse which is now a part of pylint creates reasonable UML documents.

pyreverse -o pdf project_name/models.py -p project
Keith John Hutchison
  • 4,955
  • 11
  • 46
  • 64
  • 3
    pyreverse analyzes general Python, not Django ORM model declarations. But `ForeignKey` (etc.) relationships in Django model classes are the most important information in what the OP was asking for. – Lutz Prechelt Jun 30 '21 at 17:33