diff options
| author | Aymeric Augustin | 2013-10-27 12:29:57 -0700 | 
|---|---|---|
| committer | Aymeric Augustin | 2013-10-27 12:29:57 -0700 | 
| commit | dcfa0eaa25c948f4b9e544e1bee489403014d3e7 (patch) | |
| tree | f132e5a5d0cbd6d3c18de46b62567c4584cd870a /docs | |
| parent | 7d5593bc528cd1f350b23093b00807f15e6153a3 (diff) | |
| parent | 00a2b9734f382ef8395cc85e1406c9800dcc5d0f (diff) | |
| download | django-debug-toolbar-dcfa0eaa25c948f4b9e544e1bee489403014d3e7.tar.bz2 | |
Merge pull request #430 from aaugustin/sphinx-docs
Convert README to Sphinx docs.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/Makefile | 177 | ||||
| -rw-r--r-- | docs/commands.rst | 47 | ||||
| -rw-r--r-- | docs/conf.py | 265 | ||||
| -rw-r--r-- | docs/configuration.rst | 108 | ||||
| -rw-r--r-- | docs/contributing.rst | 53 | ||||
| -rw-r--r-- | docs/index.rst | 11 | ||||
| -rw-r--r-- | docs/installation.rst | 65 | ||||
| -rw-r--r-- | docs/make.bat | 242 | ||||
| -rw-r--r-- | docs/panels.rst | 194 | 
9 files changed, 1162 insertions, 0 deletions
| diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..0c32cc1 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,177 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS    = +SPHINXBUILD   = sphinx-build +PAPER         = +BUILDDIR      = _build + +# User-friendly check for sphinx-build +ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) +$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +endif + +# Internal variables. +PAPEROPT_a4     = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext + +help: +	@echo "Please use \`make <target>' where <target> is one of" +	@echo "  html       to make standalone HTML files" +	@echo "  dirhtml    to make HTML files named index.html in directories" +	@echo "  singlehtml to make a single large HTML file" +	@echo "  pickle     to make pickle files" +	@echo "  json       to make JSON files" +	@echo "  htmlhelp   to make HTML files and a HTML help project" +	@echo "  qthelp     to make HTML files and a qthelp project" +	@echo "  devhelp    to make HTML files and a Devhelp project" +	@echo "  epub       to make an epub" +	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter" +	@echo "  latexpdf   to make LaTeX files and run them through pdflatex" +	@echo "  latexpdfja to make LaTeX files and run them through platex/dvipdfmx" +	@echo "  text       to make text files" +	@echo "  man        to make manual pages" +	@echo "  texinfo    to make Texinfo files" +	@echo "  info       to make Texinfo files and run them through makeinfo" +	@echo "  gettext    to make PO message catalogs" +	@echo "  changes    to make an overview of all changed/added/deprecated items" +	@echo "  xml        to make Docutils-native XML files" +	@echo "  pseudoxml  to make pseudoxml-XML files for display purposes" +	@echo "  linkcheck  to check all external links for integrity" +	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)" + +clean: +	rm -rf $(BUILDDIR)/* + +html: +	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html +	@echo +	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: +	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml +	@echo +	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: +	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml +	@echo +	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: +	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle +	@echo +	@echo "Build finished; now you can process the pickle files." + +json: +	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json +	@echo +	@echo "Build finished; now you can process the JSON files." + +htmlhelp: +	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp +	@echo +	@echo "Build finished; now you can run HTML Help Workshop with the" \ +	      ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: +	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp +	@echo +	@echo "Build finished; now you can run "qcollectiongenerator" with the" \ +	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:" +	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/DjangoDebugToolbar.qhcp" +	@echo "To view the help file:" +	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/DjangoDebugToolbar.qhc" + +devhelp: +	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp +	@echo +	@echo "Build finished." +	@echo "To view the help file:" +	@echo "# mkdir -p $$HOME/.local/share/devhelp/DjangoDebugToolbar" +	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/DjangoDebugToolbar" +	@echo "# devhelp" + +epub: +	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub +	@echo +	@echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: +	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex +	@echo +	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." +	@echo "Run \`make' in that directory to run these through (pdf)latex" \ +	      "(use \`make latexpdf' here to do that automatically)." + +latexpdf: +	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex +	@echo "Running LaTeX files through pdflatex..." +	$(MAKE) -C $(BUILDDIR)/latex all-pdf +	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +latexpdfja: +	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex +	@echo "Running LaTeX files through platex and dvipdfmx..." +	$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja +	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: +	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text +	@echo +	@echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: +	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man +	@echo +	@echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +texinfo: +	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo +	@echo +	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." +	@echo "Run \`make' in that directory to run these through makeinfo" \ +	      "(use \`make info' here to do that automatically)." + +info: +	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo +	@echo "Running Texinfo files through makeinfo..." +	make -C $(BUILDDIR)/texinfo info +	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +gettext: +	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale +	@echo +	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +changes: +	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes +	@echo +	@echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: +	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck +	@echo +	@echo "Link check complete; look for any errors in the above output " \ +	      "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: +	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest +	@echo "Testing of doctests in the sources finished, look at the " \ +	      "results in $(BUILDDIR)/doctest/output.txt." + +xml: +	$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml +	@echo +	@echo "Build finished. The XML files are in $(BUILDDIR)/xml." + +pseudoxml: +	$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml +	@echo +	@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." diff --git a/docs/commands.rst b/docs/commands.rst new file mode 100644 index 0000000..1d81a05 --- /dev/null +++ b/docs/commands.rst @@ -0,0 +1,47 @@ +Commands +======== + +The Debug Toolbar currently provides one Django management command. + +``debugsqlshell`` +----------------- + +This command starts an interactive Python shell, like Django's built-in +``shell`` management command. In addition, each ORM call that results in a +database query will be beautifully output in the shell. + +Here's an example:: + +    >>> from page.models import Page +    >>> ### Lookup and use resulting in an extra query... +    >>> p = Page.objects.get(pk=1) +    SELECT "page_page"."id", +           "page_page"."number", +           "page_page"."template_id", +           "page_page"."description" +    FROM "page_page" +    WHERE "page_page"."id" = 1 + +    >>> print p.template.name +    SELECT "page_template"."id", +           "page_template"."name", +           "page_template"."description" +    FROM "page_template" +    WHERE "page_template"."id" = 1 + +    Home +    >>> ### Using select_related to avoid 2nd database call... +    >>> p = Page.objects.select_related('template').get(pk=1) +    SELECT "page_page"."id", +           "page_page"."number", +           "page_page"."template_id", +           "page_page"."description", +           "page_template"."id", +           "page_template"."name", +           "page_template"."description" +    FROM "page_page" +    INNER JOIN "page_template" ON ("page_page"."template_id" = "page_template"."id") +    WHERE "page_page"."id" = 1 + +    >>> print p.template.name +    Home diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..49a4f88 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,265 @@ +# -*- coding: utf-8 -*- +# +# Django Debug Toolbar documentation build configuration file, created by +# sphinx-quickstart on Sun Oct 27 13:18:25 2013. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys +import os + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ +    'sphinx.ext.autodoc', +    'sphinx.ext.intersphinx', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'Django Debug Toolbar' +copyright = u'2013, Rob Hudson, Jannis Leidel, David Cramer, Aymeric Augustin and contributors' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '0.10.0' +# The full version, including alpha/beta/rc tags. +release = '0.10.0' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ['_build'] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +#keep_warnings = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages.  See the documentation for +# a list of builtin themes. +html_theme = 'default' + +# Theme options are theme-specific and customize the look and feel of a theme +# further.  For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents.  If None, it defaults to +# "<project> v<release> documentation". +#html_title = None + +# A shorter title for the navigation bar.  Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +#html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a <link> tag referring to it.  The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'DjangoDebugToolbardoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', + +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', + +# Additional stuff for the LaTeX preamble. +#'preamble': '', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +#  author, documentclass [howto, manual, or own class]). +latex_documents = [ +  ('index', 'DjangoDebugToolbar.tex', u'Django Debug Toolbar Documentation', +   u'Rob Hudson, Jannis Leidel, David Cramer, Aymeric Augustin and contributors', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ +    ('index', 'djangodebugtoolbar', u'Django Debug Toolbar Documentation', +     [u'Rob Hudson, Jannis Leidel, David Cramer, Aymeric Augustin and contributors'], 1) +] + +# If true, show URL addresses after external links. +#man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +#  dir menu entry, description, category) +texinfo_documents = [ +  ('index', 'DjangoDebugToolbar', u'Django Debug Toolbar Documentation', +   u'Rob Hudson, Jannis Leidel, David Cramer, Aymeric Augustin and contributors', 'DjangoDebugToolbar', 'One line description of project.', +   'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +#texinfo_appendices = [] + +# If false, no module index is generated. +#texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +#texinfo_no_detailmenu = False + + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = {'http://docs.python.org/': None} diff --git a/docs/configuration.rst b/docs/configuration.rst new file mode 100644 index 0000000..3a8c544 --- /dev/null +++ b/docs/configuration.rst @@ -0,0 +1,108 @@ +Configuration +============= + +The debug toolbar has two settings that can be set in ``settings.py``. + +#. Optional: Add a tuple called ``DEBUG_TOOLBAR_PANELS`` to your ``settings.py`` +   file that specifies the full Python path to the panel that you want included +   in the Toolbar. This setting looks very much like the ``MIDDLEWARE_CLASSES`` +   setting. For example:: + +       DEBUG_TOOLBAR_PANELS = ( +           'debug_toolbar.panels.version.VersionDebugPanel', +           'debug_toolbar.panels.timer.TimerDebugPanel', +           'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel', +           'debug_toolbar.panels.headers.HeaderDebugPanel', +           'debug_toolbar.panels.request_vars.RequestVarsDebugPanel', +           'debug_toolbar.panels.template.TemplateDebugPanel', +           'debug_toolbar.panels.sql.SQLDebugPanel', +           'debug_toolbar.panels.signals.SignalDebugPanel', +           'debug_toolbar.panels.logger.LoggingPanel', +       ) + +   You can change the ordering of this tuple to customize the order of the +   panels you want to display, or add/remove panels. If you have custom panels +   you can include them in this way -- just provide the full Python path to +   your panel. + +#. Optional: There are a few configuration options to the debug toolbar that +   can be placed in a dictionary called ``DEBUG_TOOLBAR_CONFIG``: + +   * ``INTERCEPT_REDIRECTS`` + +     If set to True, the debug toolbar will show an intermediate page upon +     redirect so you can view any debug information prior to redirecting. This +     page will provide a link to the redirect destination you can follow when +     ready. If set to False (default), redirects will proceed as normal. + +   * ``SHOW_TOOLBAR_CALLBACK`` + +     If not set or set to None, the debug_toolbar +     middleware will use its built-in show_toolbar method for determining whether +     the toolbar should show or not. The default checks are that DEBUG must be +     set to True and the IP of the request must be in INTERNAL_IPS. You can +     provide your own method for displaying the toolbar which contains your +     custom logic. This method should return True or False. + +   * ``EXTRA_SIGNALS`` + +     An array of custom signals that might be in your project, +     defined as the python path to the signal. + +   * ``HIDE_DJANGO_SQL`` + +     If set to True (the default) then code in Django itself +     won't be shown in SQL stacktraces. + +   * ``SHOW_TEMPLATE_CONTEXT`` + +     If set to True (the default) then a template's +     context will be included with it in the Template debug panel. Turning this +     off is useful when you have large template contexts, or you have template +     contexts with lazy datastructures that you don't want to be evaluated. + +   * ``TAG`` + +     If set, this will be the tag to which debug_toolbar will attach the +     debug toolbar. Defaults to 'body'. + +   * ``ENABLE_STACKTRACES`` + +     If set, this will show stacktraces for SQL queries +     and cache calls. Enabling stacktraces can increase the CPU time used when +     executing queries. Defaults to True. + +   * ``HIDDEN_STACKTRACE_MODULES`` + +     Useful for eliminating server-related entries which can result +     in enormous DOM structures and toolbar rendering delays. +     Default: ``('socketserver', 'threading', 'wsgiref', 'debug_toolbar')``. + +     (The first value is ``socketserver`` on Python 3 and ``SocketServer`` on +     Python 2.) + +   * ``ROOT_TAG_ATTRS`` + +     This setting is injected in the root template div in order to avoid conflicts +     with client-side frameworks. For example, when using with Angular.js, set +     this to 'ng-non-bindable' or 'class="ng-non-bindable"'. Defaults to ''. + +   * ``SQL_WARNING_THRESHOLD`` + +     The SQL panel highlights queries that took more that this amount of time, +     in milliseconds, to execute. The default is 500. + +   Example configuration:: + +       def custom_show_toolbar(request): +           return True  # Always show toolbar, for example purposes only. + +       DEBUG_TOOLBAR_CONFIG = { +           'INTERCEPT_REDIRECTS': True, +           'SHOW_TOOLBAR_CALLBACK': custom_show_toolbar, +           'EXTRA_SIGNALS': ['myproject.signals.MySignal'], +           'HIDE_DJANGO_SQL': False, +           'TAG': 'div', +           'ENABLE_STACKTRACES' : True, +           'HIDDEN_STACKTRACE_MODULES': ('gunicorn', 'newrelic'), +       } diff --git a/docs/contributing.rst b/docs/contributing.rst new file mode 100644 index 0000000..061d9a3 --- /dev/null +++ b/docs/contributing.rst @@ -0,0 +1,53 @@ +Contributing +============ + +Code +---- + +The code is available `on GitHub +<http://github.com/django-debug-toolbar/django-debug-toolbar>`_. + +Once you've obtained a checkout, you should create a virtualenv_ and install +the libraries required for working on the Debug Toolbar:: + +    $ pip install -r requirements_dev.txt + +.. _virtualenv: http://www.virtualenv.org/ + +Once you've done this, you can run the test suite on all supported version of +Django and Python:: + +    $ tox + +Bug reports and feature requests +-------------------------------- + +You can report bugs and request features in the `bug tracker +<http://github.com/django-debug-toolbar/django-debug-toolbar/issues>`_. + +Please search the existing database for duplicates before filing an issue. + +Patches +------- + +Please submit `pull requests +<http://github.com/django-debug-toolbar/django-debug-toolbar/pulls>`_! + +The Debug Toolbar includes a limited but growing test suite. If you fix a bug +or add a feature code, please consider adding proper coverage in the test +suite, especially if it has a chance for a regression. + +Translations +------------ + +Translation efforts are coordinated on `Transifex +<https://www.transifex.net/projects/p/django-debug-toolbar/>`_. + +Help translate the Debug Toolbar in your language! + + +Mailing list +------------ + +This project doesn't have a mailing list at this time. If you wish to discuss +a topic, please open an issue on GitHub. diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..5134a83 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,11 @@ +Django Debug Toolbar +==================== + +.. toctree:: +   :maxdepth: 2 + +   installation +   configuration +   panels +   commands +   contributing diff --git a/docs/installation.rst b/docs/installation.rst new file mode 100644 index 0000000..1e228cb --- /dev/null +++ b/docs/installation.rst @@ -0,0 +1,65 @@ +Installation +============ + +#. The recommended way to install the Debug Toolbar is via pip_:: + +       $ pip install django-debug-toolbar + +   If you aren't familiar with pip, you may also obtain a copy of the +   ``debug_toolbar`` directory and add it to your Python path. + +   .. _pip: http://www.pip-installer.org/ + + +   To test an upcoming release, you can install the `in-development version +   <http://github.com/django-debug-toolbar/django-debug-toolbar/tarball/master#egg=django-debug-toolbar-dev>`_ +   instead with the following command:: + +        $ pip install django-debug-toolbar==dev + +#. Add the following middleware to your project's ``settings.py`` file:: + +       MIDDLEWARE_CLASSES = ( +           # ... +           'debug_toolbar.middleware.DebugToolbarMiddleware', +           # ... +       ) + +   Tying into middleware allows each panel to be instantiated on request and +   rendering to happen on response. + +   The order of ``MIDDLEWARE_CLASSES`` is important: the Debug Toolbar +   middleware must come after any other middleware that encodes the +   response's content (such as GZipMiddleware). + +   .. note:: + +      The debug toolbar will only display itself if the mimetype of the +      response is either ``text/html`` or ``application/xhtml+xml`` and +      contains a closing ``</body>`` tag. + +   .. note :: + +      Be aware of middleware ordering and other middleware that may intercept +      requests and return responses. Putting the debug toolbar middleware +      *after* the Flatpage middleware, for example, means the toolbar will not +      show up on flatpages. + +#. Make sure your IP is listed in the ``INTERNAL_IPS`` setting. If you are +   working locally this will be:: + +       INTERNAL_IPS = ('127.0.0.1',) + +   .. note:: + +      This is required because of the built-in requirements of the +      ``show_toolbar`` method. See below for how to define a method to +      determine your own logic for displaying the toolbar. + +#. Add ``debug_toolbar`` to your ``INSTALLED_APPS`` setting so Django can +   find the template files associated with the Debug Toolbar:: + +       INSTALLED_APPS = ( +           # ... +           'debug_toolbar', +       ) diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..ab7ecb7 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,242 @@ +@ECHO OFF
 +
 +REM Command file for Sphinx documentation
 +
 +if "%SPHINXBUILD%" == "" (
 +	set SPHINXBUILD=sphinx-build
 +)
 +set BUILDDIR=_build
 +set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
 +set I18NSPHINXOPTS=%SPHINXOPTS% .
 +if NOT "%PAPER%" == "" (
 +	set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
 +	set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
 +)
 +
 +if "%1" == "" goto help
 +
 +if "%1" == "help" (
 +	:help
 +	echo.Please use `make ^<target^>` where ^<target^> is one of
 +	echo.  html       to make standalone HTML files
 +	echo.  dirhtml    to make HTML files named index.html in directories
 +	echo.  singlehtml to make a single large HTML file
 +	echo.  pickle     to make pickle files
 +	echo.  json       to make JSON files
 +	echo.  htmlhelp   to make HTML files and a HTML help project
 +	echo.  qthelp     to make HTML files and a qthelp project
 +	echo.  devhelp    to make HTML files and a Devhelp project
 +	echo.  epub       to make an epub
 +	echo.  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter
 +	echo.  text       to make text files
 +	echo.  man        to make manual pages
 +	echo.  texinfo    to make Texinfo files
 +	echo.  gettext    to make PO message catalogs
 +	echo.  changes    to make an overview over all changed/added/deprecated items
 +	echo.  xml        to make Docutils-native XML files
 +	echo.  pseudoxml  to make pseudoxml-XML files for display purposes
 +	echo.  linkcheck  to check all external links for integrity
 +	echo.  doctest    to run all doctests embedded in the documentation if enabled
 +	goto end
 +)
 +
 +if "%1" == "clean" (
 +	for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
 +	del /q /s %BUILDDIR%\*
 +	goto end
 +)
 +
 +
 +%SPHINXBUILD% 2> nul
 +if errorlevel 9009 (
 +	echo.
 +	echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
 +	echo.installed, then set the SPHINXBUILD environment variable to point
 +	echo.to the full path of the 'sphinx-build' executable. Alternatively you
 +	echo.may add the Sphinx directory to PATH.
 +	echo.
 +	echo.If you don't have Sphinx installed, grab it from
 +	echo.http://sphinx-doc.org/
 +	exit /b 1
 +)
 +
 +if "%1" == "html" (
 +	%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
 +	if errorlevel 1 exit /b 1
 +	echo.
 +	echo.Build finished. The HTML pages are in %BUILDDIR%/html.
 +	goto end
 +)
 +
 +if "%1" == "dirhtml" (
 +	%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
 +	if errorlevel 1 exit /b 1
 +	echo.
 +	echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
 +	goto end
 +)
 +
 +if "%1" == "singlehtml" (
 +	%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
 +	if errorlevel 1 exit /b 1
 +	echo.
 +	echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
 +	goto end
 +)
 +
 +if "%1" == "pickle" (
 +	%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
 +	if errorlevel 1 exit /b 1
 +	echo.
 +	echo.Build finished; now you can process the pickle files.
 +	goto end
 +)
 +
 +if "%1" == "json" (
 +	%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
 +	if errorlevel 1 exit /b 1
 +	echo.
 +	echo.Build finished; now you can process the JSON files.
 +	goto end
 +)
 +
 +if "%1" == "htmlhelp" (
 +	%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
 +	if errorlevel 1 exit /b 1
 +	echo.
 +	echo.Build finished; now you can run HTML Help Workshop with the ^
 +.hhp project file in %BUILDDIR%/htmlhelp.
 +	goto end
 +)
 +
 +if "%1" == "qthelp" (
 +	%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
 +	if errorlevel 1 exit /b 1
 +	echo.
 +	echo.Build finished; now you can run "qcollectiongenerator" with the ^
 +.qhcp project file in %BUILDDIR%/qthelp, like this:
 +	echo.^> qcollectiongenerator %BUILDDIR%\qthelp\DjangoDebugToolbar.qhcp
 +	echo.To view the help file:
 +	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\DjangoDebugToolbar.ghc
 +	goto end
 +)
 +
 +if "%1" == "devhelp" (
 +	%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
 +	if errorlevel 1 exit /b 1
 +	echo.
 +	echo.Build finished.
 +	goto end
 +)
 +
 +if "%1" == "epub" (
 +	%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
 +	if errorlevel 1 exit /b 1
 +	echo.
 +	echo.Build finished. The epub file is in %BUILDDIR%/epub.
 +	goto end
 +)
 +
 +if "%1" == "latex" (
 +	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
 +	if errorlevel 1 exit /b 1
 +	echo.
 +	echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
 +	goto end
 +)
 +
 +if "%1" == "latexpdf" (
 +	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
 +	cd %BUILDDIR%/latex
 +	make all-pdf
 +	cd %BUILDDIR%/..
 +	echo.
 +	echo.Build finished; the PDF files are in %BUILDDIR%/latex.
 +	goto end
 +)
 +
 +if "%1" == "latexpdfja" (
 +	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
 +	cd %BUILDDIR%/latex
 +	make all-pdf-ja
 +	cd %BUILDDIR%/..
 +	echo.
 +	echo.Build finished; the PDF files are in %BUILDDIR%/latex.
 +	goto end
 +)
 +
 +if "%1" == "text" (
 +	%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
 +	if errorlevel 1 exit /b 1
 +	echo.
 +	echo.Build finished. The text files are in %BUILDDIR%/text.
 +	goto end
 +)
 +
 +if "%1" == "man" (
 +	%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
 +	if errorlevel 1 exit /b 1
 +	echo.
 +	echo.Build finished. The manual pages are in %BUILDDIR%/man.
 +	goto end
 +)
 +
 +if "%1" == "texinfo" (
 +	%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
 +	if errorlevel 1 exit /b 1
 +	echo.
 +	echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
 +	goto end
 +)
 +
 +if "%1" == "gettext" (
 +	%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
 +	if errorlevel 1 exit /b 1
 +	echo.
 +	echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
 +	goto end
 +)
 +
 +if "%1" == "changes" (
 +	%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
 +	if errorlevel 1 exit /b 1
 +	echo.
 +	echo.The overview file is in %BUILDDIR%/changes.
 +	goto end
 +)
 +
 +if "%1" == "linkcheck" (
 +	%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
 +	if errorlevel 1 exit /b 1
 +	echo.
 +	echo.Link check complete; look for any errors in the above output ^
 +or in %BUILDDIR%/linkcheck/output.txt.
 +	goto end
 +)
 +
 +if "%1" == "doctest" (
 +	%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
 +	if errorlevel 1 exit /b 1
 +	echo.
 +	echo.Testing of doctests in the sources finished, look at the ^
 +results in %BUILDDIR%/doctest/output.txt.
 +	goto end
 +)
 +
 +if "%1" == "xml" (
 +	%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
 +	if errorlevel 1 exit /b 1
 +	echo.
 +	echo.Build finished. The XML files are in %BUILDDIR%/xml.
 +	goto end
 +)
 +
 +if "%1" == "pseudoxml" (
 +	%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
 +	if errorlevel 1 exit /b 1
 +	echo.
 +	echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
 +	goto end
 +)
 +
 +:end
 diff --git a/docs/panels.rst b/docs/panels.rst new file mode 100644 index 0000000..a4b809e --- /dev/null +++ b/docs/panels.rst @@ -0,0 +1,194 @@ +Panels +====== + +The Django Debug Toolbar ships with a series of built-in panels. In addition, +several third-party panels are available. + +Default built-in panels +----------------------- + +The following panels are enabled by default. + +Version +~~~~~~~ + +Path: ``debug_toolbar.panels.version.VersionDebugPanel`` + +Django version. + +Timer +~~~~~ + +Path: ``debug_toolbar.panels.timer.TimerDebugPanel`` + +Request timer. + +Settings +~~~~~~~~ + +Path: ``debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel`` + +A list of settings in settings.py. + +Header +~~~~~~ + +Path: ``debug_toolbar.panels.headers.HeaderDebugPanel`` + +Common HTTP headers. + +Request +~~~~~~~ + +Path: ``debug_toolbar.panels.request_vars.RequestVarsDebugPanel`` + +GET/POST/cookie/session variable display. + +SQL +~~~ + +Path: ``debug_toolbar.panels.sql.SQLDebugPanel`` + +SQL queries including time to execute and links to EXPLAIN each query. + +Template +~~~~~~~~ + +Path: ``debug_toolbar.panels.template.TemplateDebugPanel`` + +Templates and context used, and their template paths. + +Cache +~~~~~ + +Path: ``debug_toolbar.panels.cache.CacheDebugPanel`` + +Cache queries. + +Signal +~~~~~~ + +Path: ``debug_toolbar.panels.signals.SignalDebugPanel`` + +List of signals, their args and receivers. + +Logging +~~~~~~~ + +Path: ``debug_toolbar.panels.logger.LoggingPanel`` + +Logging output via Python's built-in :mod:`logging`, or via the `logbook <http://logbook.pocoo.org>`_ module. + +Non-default built-in panels +--------------------------- + +The following panels are disabled by default. You must add them to the +``DEBUG_TOOLBAR_PANELS`` setting to enable them. + +Profiling +~~~~~~~~~ + +Path: ``debug_toolbar.panels.profiling.ProfilingDebugPanel`` + +Profiling information for the view function. + +Third-party panels +------------------ + +.. note:: Third-party panels aren't officially supported! + +    The authors of the Django Debug Toolbar maintain a list of third-party +    panels, but they can't vouch for the quality of each of them. Please +    report bugs to their authors. + +If you'd like to add a panel to this list, please submit a pull request! + +Haystack +~~~~~~~~ + +URL: https://github.com/streeter/django-haystack-panel + +Path: ``haystack_panel.panel.HaystackDebugPanel`` + +See queries made by your Haystack_ backends. + +.. _Haystack: http://haystacksearch.org/ + +HTML Tidy/Validator +~~~~~~~~~~~~~~~~~~~ + +URL: https://github.com/joymax/django-dtpanel-htmltidy + +Path: ``debug_toolbar_htmltidy.panels.HTMLTidyDebugPanel`` + +HTML Tidy or HTML Validator is a custom panel that validates your HTML and +displays warnings and errors. + +Inspector +~~~~~~~~~ + +URL: https://github.com/santiagobasulto/debug-inspector-panel + +Path: ``inspector_panel.panels.inspector.InspectorPanel`` + +Retrieves and displays information you specify using the ``debug`` statement. +Inspector panel also logs to the console by default, but may be instructed not +to. + +Memcache +~~~~~~~~ + +URL: https://github.com/ross/memcache-debug-panel + +Path: ``memcache_toolbar.panels.memcache.MemcachePanel`` or ``memcache_toolbar.panels.pylibmc.PylibmcPanel`` + +This panel tracks memcached usage. It currently supports both the pylibmc and +memcache libraries. + +MongoDB +~~~~~~~ + +URL: https://github.com/hmarr/django-debug-toolbar-mongo + +Path: ``debug_toolbar_mongo.panel.MongoDebugPanel`` + +Adds MongoDB debugging information. + +Neo4j +~~~~~ + +URL: https://github.com/robinedwards/django-debug-toolbar-neo4j-panel + +Path: ``neo4j_panel.Neo4jPanel`` + +Trace neo4j rest API calls in your django application, this also works for neo4django and neo4jrestclient, support for py2neo is on its way. + +Sites +~~~~~ + +URL: https://github.com/elvard/django-sites-toolbar + +Path: ``sites_toolbar.panels.SitesDebugPanel`` + +Browse Sites registered in ``django.contrib.sites`` and switch between them. +Useful to debug project when you use `django-dynamicsites +<https://bitbucket.org/uysrc/django-dynamicsites/src>`_ which sets SITE_ID +dynamically. + +Template Timings +~~~~~~~~~~~~~~~~ + +URL: https://github.com/orf/django-debug-toolbar-template-timings + +Path: ``template_timings_panel.panels.TemplateTimings.TemplateTimings`` + +Displays template rendering times for your Django application. + +User +~~~~ + +URL: https://github.com/playfire/django-debug-toolbar-user-panel + +Path: ``debug_toolbar_user_panel.panels.UserPanel`` + +Easily switch between logged in users, see properties of current user. | 
