Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django - graph models relationships [closed]

Tags:

django

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?

like image 653
Mažas Avatar asked Mar 03 '16 11:03

Mažas


2 Answers

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
like image 200
scytale Avatar answered Nov 08 '22 08:11

scytale


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
like image 38
Mushahid Khan Avatar answered Nov 08 '22 09:11

Mushahid Khan