有没有Django项目结构/信息流可视化工具? [英] Is there a tool for Django project structure/information flow visualization?

查看:157
本文介绍了有没有Django项目结构/信息流可视化工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想能够查看我的Django项目的结构,即哪些URL指向哪些视图,哪些视图指向哪个模板,哪些CSS文件包含在哪个模板中。



我知道伟大的模型可视化工具 Django命令扩展程序中,但是我需要一个能够可视化的不同工具链接:


  1. 网址和视图;

  2. 视图和模板;

  3. 模板和其他模板(通过 {%extends%} {%include%} 和自定义模板标签);

  4. 模板和静态文件(css,js,图像)。

有没有?

解决方案

无法创建您正在寻找的工具在实践中很好Django不强迫你任何结构。工具只能用严格的结构工作。另外django还可以充分利用python的动态特性。创建可以了解项目动态的工具太难了。



几个例子:




  • 视图可以是由工厂方法生成的方法。


  • 视图可以在不同的情况下渲染不同的模板。


  • URL可以动态生成


  • 可以使用自定义url reslover


  • 可以在 {%extend%} 标签中使用变量。让我们说一个验证用户的基本模板,另一个用于匿名用户。




为您提供了大量可视化信息的工具项目是java世界常见的,但不是python。



python的一个很大的优点是它允许快速写入可读代码。通常写得很好,结构良好的代码解释它自己很好,没有额外的工具。



为了简化模板/查看发现的过程,你应该有很好的代码结构,为视图/模板/网址创建一些项目级命名约定。


I would like to be able to view the structure of my Django project, i.e. which urls point to which views, which views point to which templates, which css files are included in which templates etc.

I know about the great model visualization tool in Django command extensions, but I need a different tool that is able to visualize links between:

  1. Urls and views;
  2. Views and templates;
  3. Templates and other templates (via {% extends %}, {% include %} and custom template tags);
  4. Templates and static files (css, js, images).

Are there any?

解决方案

It is impossible to create tools which you are looking for that would work good in practice. Django does not force you to any structure. Tool can only be made to work with strict structure. Also django allows you to take full advantage of the dynamic nature of python. It is too difficult to create tools which could understand dynamics of your project.

Few examples:

  • views can be methods generated by factory-methods.

  • a view can render different templates in different situations.

  • Urls can be generated dynamically

  • Custom url reslover can be used

  • Variable can be used in {% extend %} tag. Lets say one base template for authenticated user and other for anonymous.

Tools which gives you a lot of visual information about project is common to java world but not to python.

One great advantage of python is that it allows to write readable code fast. Usually well written and well structured code explains it self quite well without additional tools.

To ease the process of template/view finding you should have good structure of your code and maybe invent some project-level naming conventions for views/templates/urls.

这篇关于有没有Django项目结构/信息流可视化工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆