Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to generate a diagram of an entire Django webapp? [closed]

Is it possible to generate a diagram of an entire Django site? For example, to understand the model/database structure I use graphViz which is extremely useful for keeping track of the model structure, and very useful for discussions.

I was curious if something similar existed for the complete Django site so that urls/models/views/templates could all be represented graphically. I don't quite know what that would look like but am curious if any tool exists to do this.

This would programmatically generate a diagram showing the code flow between different parts of the site.

like image 358
djq Avatar asked May 01 '13 14:05

djq


People also ask

Can you work on Django offline?

You can make Django web apps work faster, more engaging and also work offline. You just need to have support for sevice worker's in your target browser.

What is Inspectdb in Django?

Django comes with a utility called inspectdb that can create models by introspecting an existing database. You can view the output by running this command: $ python manage.py inspectdb. Save this as a file by using standard Unix output redirection: $ python manage.py inspectdb > models.py.

What is AutoField in Django?

AutoField. An IntegerField that automatically increments according to available IDs. You usually won't need to use this directly; a primary key field will automatically be added to your model if you don't specify otherwise.


1 Answers

You can use django-extensions app for generating model visualisations.

setting.py

INSTALLED_APPS = (     'django.contrib.auth',     'django.contrib.contenttypes',     'django.contrib.sessions',     'django.contrib.sites',     'django.contrib.messages',     'django.contrib.staticfiles',      '...',      'django_extensions',     'django.contrib.admin',     # Uncomment the next line to enable admin documentation:     # 'django.contrib.admindocs', ) 

Give this command in terminal

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

This will generate a png file named myapp_models.png. It will have visualised image of the models. More documentation can be found here.

like image 182
Muhammed K K Avatar answered Oct 09 '22 01:10

Muhammed K K