Skip to content

tclancy/django-detect-cyclic

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django detect cyclic

Application to detect cyclic imports. With this application you can analyze the dependence of your applications

image

Requeriments

Installation

In your settings.py:

INSTALLED_APPS = (

    'django_detect_cyclic',

)

In your urls.py:

urlpatterns = patterns('',

    (r'^admin/detect_cyclic/', include('django_detect_cyclic.urls')),

)

Make sure that you have in your urls jsi18nurl:

js_info_dict = {
    'packages': ('your.app.package',),
}

urlpatterns = patterns('',

    url(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict),

)

Caption

  • The nodes are applications, or (if you use the option “Show modules”) modules in the applications
  • One edge means that the source node imports from the destination node
  • Every edge of a cycle has the same background color and the label contains “Cycle X”
  • The labels of the edges contain the weight in parentheses
  • If you use the “Show modules” option, each node will have a background color. If two nodes are from the same application, they will have the same background color.
  • If an edge is dotted, every import in the source happens at runtime, whithin the body of a function or method

Possibles Errors

It is possible that the next links are interested if you can some problem:

It is possible that you have to remove the pyc files:

find -iname "*.pyc" -exec rm "{}" \;

Usage

You have two ways, you can run a command:

python manage.py detect_cyclic
python manage.py detect_cyclic --include-apps="app1,app6,app7,app11" --file-name="my_graph.svg" --exclude-packages="migrations,templatetags" --verbosity=2
python manage.py detect_cyclic --include-apps="app1,app6" --show-modules --file-name="my_graph.svg" --exclude-packages="migrations" --verbosity=2
python manage.py detect_cyclic --include-apps="app1,app6" --only-cyclic --file-name="my_graph.svg" --exclude-packages="migrations" --verbosity=2

Or you can access via web to the wizard:

/admin/detect_cyclic/

Examples

To see more examples click in examples

About

Django detect cyclic

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 74.9%
  • JavaScript 15.5%
  • HTML 8.2%
  • CSS 1.4%