{ "info": { "author": "Diederik van der Boor", "author_email": "opensource@edoburu.nl", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 1.10", "Framework :: Django :: 1.11", "Framework :: Django :: 1.4", "Framework :: Django :: 1.5", "Framework :: Django :: 1.6", "Framework :: Django :: 1.7", "Framework :: Django :: 1.8", "Framework :: Django :: 1.9", "Framework :: Django :: 2.0", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Debuggers" ], "description": "Introduction\n============\n\nThe ``debugtools`` module offers some easy to use debugging utilities to assist Django development.\nIt features:\n\n* A template tag to print context.\n* A ``XViewMiddleware`` variation to see which *view* and *template* was used to render a page.\n* A panel for django-debug-toolbar_ to show which *view* and *template* was used to render a page.\n* A jQuery ``debug()`` function.\n\n\nInstallation\n============\n\nFirst install the module, preferably in a virtual environment. It can be installed from PyPI::\n\n pip install django-debugtools\n\nOr the current folder can be installed::\n\n pip install .\n\nConfiguration\n-------------\n\nAdd the module to the installed apps::\n\n INSTALLED_APPS += (\n 'debugtools',\n )\n\nAs of Django 1.9, either use ``{% load debugtools_tags %}`` or add the following to the settings:\n\n.. code-block:: python\n\n TEMPLATES = [\n {\n 'BACKEND': 'django.template.backends.django.DjangoTemplates',\n 'DIRS': [],\n 'APP_DIRS': True,\n 'OPTIONS': {\n 'context_processors': [\n 'django.template.context_processors.debug',\n 'django.template.context_processors.request',\n # ...\n ],\n 'builtins': [ # Add this section\n \"debugtools.templatetags.debugtools_tags\", # Add this line\n ],\n },\n },\n ]\n\nOr, when you use a ``local.py`` settings file:\n\n.. code-block:: python\n\n TEMPLATES[0]['OPTIONS']['builtins'] += [\n \"debugtools.templatetags.debugtools_tags\", # enables {% print %}\n ]\n\n\nFeatures\n--------\n\nPrint Template Tag\n~~~~~~~~~~~~~~~~~~\n\nIn Django templates, the following code can be used::\n\n {% print variable1 variable2 %}\n\nThis will print out the specific variables, in case of ``{% print original %}``:\n\n.. image:: https://github.com/edoburu/django-debugtools/raw/master/docs/images/print-original.png\n :width: 959px\n :height: 166px\n\nWhen no variables are given (e.g. ``{% print %}``), all context variables are displayed:\n\n.. image:: https://github.com/edoburu/django-debugtools/raw/master/docs/images/template-context.png\n :width: 744px\n :height: 569px\n\n\nThe template context variables are printed in a customized ``pprint.pformat`` format, for easy reading.\nNote no ``{% load %}`` tag is needed; the ``{% print %}`` function is added to the template builtins for debugging convenience.\n\nPrint Queries template tag\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nFor convenience, there is also a ``{% print_queries %}`` tag,\nbased on http://djangosnippets.org/snippets/93/\n\nFor more sophisticated debugging, you may want to use the *django-debug-toolbar* for this job.\n\n\nDebug Toolbar Panel\n~~~~~~~~~~~~~~~~~~~\n\nAdd the following settings to your django-debug-toolbar_ configuration::\n\n DEBUG_TOOLBAR_PANELS = (\n 'debug_toolbar.panels.versions.VersionsPanel',\n 'debug_toolbar.panels.timer.TimerPanel',\n 'debug_toolbar.panels.settings.SettingsPanel',\n 'debug_toolbar.panels.headers.HeadersPanel',\n 'debug_toolbar.panels.request.RequestPanel',\n 'debug_toolbar.panels.sql.SQLPanel',\n 'debug_toolbar.panels.staticfiles.StaticFilesPanel',\n 'debugtools.panels.ViewPanel', # Add this one\n 'debug_toolbar.panels.templates.TemplatesPanel',\n 'debug_toolbar.panels.cache.CachePanel',\n 'debug_toolbar.panels.signals.SignalsPanel',\n 'debug_toolbar.panels.logging.LoggingPanel',\n 'debug_toolbar.panels.redirects.RedirectsPanel',\n )\n\n.. image:: https://github.com/edoburu/django-debugtools/raw/master/docs/images/debug-toolbar.png\n :width: 887px\n :height: 504px\n\n|\n\njQuery debug print\n~~~~~~~~~~~~~~~~~~\n\nAdd the following to the page::\n\n \n\nNow you can print the jQuery selector context to the console::\n\n $(\"#foo\").children('li').debug().addClass('bar');\n\nThis will print the matched ``