Python 是否可以生成整个 Django webapp 的图表?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16320197/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is it possible to generate a diagram of an entire Django webapp?
提问by djq
Is it possible to generate a diagram of an entire Django site? For example, to understand the model/database structure I use graphVizwhich is extremely useful for keeping track of the model structure, and very useful for discussions.
是否可以生成整个 Django 站点的图表?例如,为了理解模型/数据库结构,我使用了graphViz,它对于跟踪模型结构非常有用,对于讨论也非常有用。
I was curious if something similar existed for the complete Django site so that urls/models/views/templatescould all be represented graphically. I don't quite know what that would look like but am curious if any tool exists to do this.
我很好奇整个 Django 站点是否存在类似的东西,以便urls/models/views/templates可以用图形表示。我不太清楚那会是什么样子,但很好奇是否有任何工具可以做到这一点。
This would programmatically generate a diagram showing the code flow between different parts of the site.
这将以编程方式生成一个图表,显示站点不同部分之间的代码流。
回答by Jordi Cabot
Hereyou can find a list of Python-to-UML tools. The one called GraphModelsin django-extensions(PyPI) may cover what you're looking for.
在这里您可以找到 Python-to-UML 工具的列表。在django-extensions( PyPI) 中称为GraphModels 的可能涵盖您正在寻找的内容。
回答by Rahul
You can use django-extension for generating the app models i.e database. and also you can generate UML generating applications.
您可以使用 django-extension 生成应用程序模型,即数据库。并且您还可以生成 UML 生成应用程序。
回答by Muhammed K K
You can use django-extensionsapp for generating model visualisations.
您可以使用django-extensions应用程序生成模型可视化。
setting.py
设置.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.
这将生成一个名为 myapp_models.png 的 png 文件。它将具有模型的可视化图像。可以在此处找到更多文档。
回答by janek37
I've stumbled upon this problem today and I found django-dia. It looks good, if you like Dia!
我今天偶然发现了这个问题,我找到了django-dia。看起来不错,如果你喜欢迪亚!

