0

I am using django-extensions to generate a model graph for my Django application.

My installation steps are the following:

$ pip install django-extensions
$ pip install pyparsing pydot

An installation of pygraphviz fails (as described) due to missing C extensions:

$ pip install pygraphviz # this does not work

Now, using the pydot option from the graph_models documentation works for .dot files:

$ python manage.py graph_models -a -I Device,Vehicle -o my_project_subsystem.dot

But creating PNG files breaks and indicates that dot is not on PATH:

$ python manage.py graph_models --pydot -a -g -o my_project_visualized.png

with an error:

FileNotFoundError: [WinError 2] "dot" not found in path

A fix to this problem using conda and pygraphviz is provided in this answer.

But how can I create graphs with only using pip without using anaconda? To me, it does not matter if use pydot or pygraphviz. I just want to create models into PNG files.

Thanks in advance!

Cord Kaldemeyer
  • 5,366
  • 7
  • 41
  • 65

1 Answers1

0

It took a while but I got it working using the following steps:

  1. Install django extensions via $ pip install django-extensions==3.1.5
  2. Install pydotplus via $ pip install pydotplus==2.0.2
  3. Install GraphViz via installer and MANUALLY add it to the user PATH

Include django_extensions in settings.py:

INSTALLED_APPS = (
    ...
    'django_extensions',
    ...
)

Run command:

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

cigien
  • 55,661
  • 11
  • 60
  • 99
Cord Kaldemeyer
  • 5,366
  • 7
  • 41
  • 65