7

As django project get bigger, it is hard to see all app's model relationships (ForeignKey's, ManyToMany Fields). Is there any program that can make easy looking graph of model relationship?

Mažas
  • 387
  • 1
  • 6
  • 19
  • Possible duplicate of http://stackoverflow.com/questions/6776592/django-model-graphic-representation-erd – Forge Mar 03 '16 at 11:29

2 Answers2

11

django extensions has a command to do this

pip install django-extensions

settings:

INSTALLED_APPS = (
    ...
    'django_extensions',
)

run command

manage.py graph_models --pygraphviz -a -g -o my_project_visualized.png
scytale
  • 12,346
  • 3
  • 32
  • 46
2

First setup using this Graphviz

Go through step by step:

after this install graphviz or mac using

$ brew install graphviz

use this command to generate database documentation using Schemaspy and graphviz :

java -jar schemaSpy_5.0.0.jar -t pgsql -db `db_name`  -host 127.0.0.1 -u `db_user` -p admin -o ./schemaspy -dp postgresql-9.4-1206-jdbc4.jar -s public -noads
Mushahid Khan
  • 2,816
  • 1
  • 19
  • 32