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?
Asked
Active
Viewed 4,382 times
2 Answers
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
-
-
2If you're on OSX: 1. `brew install graphviz`, 2. `pip install pygraphviz`, 3. `pip install django-extensions` – aralar Oct 13 '16 at 18:55
-
for ubuntu: ```apt-get install libgraphviz-dev``` was required before pip install – Cuyler Quint Jun 30 '21 at 17:58
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