django应用程序检测循环导入

django-detect-cyclic的Python项目详细描述


Django detect cyclic

用于检测循环导入的应用程序。 使用此应用程序,您可以分析应用程序的依赖性

https://github.com/goinnn/django-detect-cyclic/raw/master/examples/example-only-cyclic-exclude.png

Requeriments

Installation

在您的设置中。py:

INSTALLED_APPS = (

    'django_detect_cyclic',

)

在您的url.py:

urlpatterns = patterns('',

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

)

确保您的url中有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

如果您有什么问题,可能会对下一个链接感兴趣:

您可能需要删除PYC文件:

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

Usage

有两种方法,可以运行命令:

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

或者您可以通过Web访问向导:

/admin/detect_cyclic/

Examples

要查看更多示例,请单击examples

Releases

0.0.9 (2012-09-02)

  • 修复一些错误
  • 使代码适应pyplete的最后一个版本。现在检测相对导入,如下所示:
from models import MyModel # from the same directory of the models.py

这个:

from .models import MyModel # from the same directory of the models.py

0.0.8 (2012-08-09)

  • Loaded a templatetag, and with this you get a error
  • Now works the js in Django 1.4
  • Fix a error when you had some application repeat in your settings (INSTALLED_APPS)
  • Fix a csr error when you click in download the graph and the format is svg-js

0.0.7 (2012-07-25)

  • Now jquery.graphviz has a stable version (0.0.1, Tested in Chrome, FireFox, Safari and IE9)
  • Detail to the js

0.0.6 (2012-07-23)

  • Format svg-js (beta). Change dracula js to jquery.graphviz.js (Tested in Chrome and FireFox)

0.0.5 (2012-07-13)

  • Change force-colors option to use-colors option
  • Change distribution of the wizard
  • Usability

0.0.4 (2012-07-12)

  • Wizard to create graphs (/admin/detect_cyclic/)
  • Format svg-js (alpha)
  • Fix a little errors

0.0.3 (2012-07-10)

  • Add the option “scope-global”, this ignore the imports into the functions
  • Now if the verbosity option is 1, only show the errors
  • Now when a node (with show-modules) has the same name that a application, the node name will be app_name.__init__
  • Now the label of the cycle edges has the same color that the edge
  • Now disabled the colors of the edge and nodes when the format is not svg. But it is possible enabled if you use the “force color” option
  • Optimizations
  • New option “dotted-scope-local”. If the all import between two nodes are into a function the edge will be dotted
  • Fixed some little errors

0.0.2 (2012-07-09)

  • Documentation and examples

0.0.1 (2012-07-09)

  • Initial release.

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何在jprogressbar上添加文本?   java生成30到32位之间的随机数   我想从我自己的服务器而不是java worldwind中的nasa服务器获取数据   jsp中带有外部java文件的html计数器   java如何找到运行Servlet的主机和端口   我怎么能看到数学。java中的cos方法计算平方根?   java这个docker run命令做什么?   java如何在将表单提交到servlet后将原始JSP保存在URL中?   如何在Java中访问Arraylist中的字典数据?   java JPA如果我有一个实体被用作复合键,那么级联是否也构成复合键的一部分?   连接Java:文件读取/添加到文件程序时未按预期工作(逻辑错误)   java从Android向PLC发送布尔值   java Get build。gradle文件作为一个。类文件   Youtube API V3 Java无需调用浏览器即可上传视频   java如何在Unittest中测试StackOverflower错误   实现方法中的java异常处理   java这个::instanceMethod在java8中用作方法参数有什么用途   java偶尔会获得javax。邮政使用javamail阅读gmail电子邮件时的FolderClosedException