8

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?

General Grievance
  • 4,555
  • 31
  • 31
  • 45
Dennis Golomazov
  • 16,269
  • 5
  • 73
  • 81
  • That would be pretty cool. You're looking for something that inspects and automatically creates a map correct? Thanks for the link to the model visualization tool. – Yuji 'Tomita' Tomita Feb 10 '11 at 13:07

1 Answers1

4

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.

Ski
  • 14,197
  • 3
  • 54
  • 64
  • 1
    Thank you for the answer. Personally, I am not happy with it, since it's basically negative. I wish there was a tool that allows visualizing at least more or less simple projects. It could not cover all possible cases, but give just an overview. Since there are no other (positive) answers and yours is well-explained, I accept it. Thank you. – Dennis Golomazov Mar 12 '11 at 12:34
  • 1
    I don't think most of these things would be impossible, rather some of these would be hard to accomplish. – Ravi Kumar Dec 04 '12 at 05:53
  • I realise that it's an old question but FWIW I just added an answer to a related question about template inheritance graph visualisation (http://stackoverflow.com/a/40708208/846115) – benebun Nov 20 '16 at 19:10