/usr/share/doc/python-werkzeug-doc/html/debug.html is in python-werkzeug-doc 0.9.4+dfsg-1.1ubuntu2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Debugging Applications — Werkzeug 0.9.4 documentation</title>
<link rel="stylesheet" href="_static/werkzeug.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.9.4',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Werkzeug 0.9.4 documentation" href="index.html" />
<link rel="next" title="Request / Response Objects" href="wrappers.html" />
<link rel="prev" title="Test Utilities" href="test.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="wrappers.html" title="Request / Response Objects"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="test.html" title="Test Utilities"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Werkzeug 0.9.4 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="module-werkzeug.debug">
<span id="debugging-applications"></span><h1>Debugging Applications<a class="headerlink" href="#module-werkzeug.debug" title="Permalink to this headline">¶</a></h1>
<p>Depending on the WSGI gateway/server, exceptions are handled differently.
But most of the time, exceptions go to stderr or the error log.</p>
<p>Since this is not the best debugging environment, Werkzeug provides a
WSGI middleware that renders nice debugging tracebacks, optionally with an
AJAX based debugger (which allows to execute code in the context of the
traceback’s frames).</p>
<p>The interactive debugger however does not work in forking environments
which makes it nearly impossible to use on production servers. Also the
debugger allows the execution of arbitrary code which makes it a major
security risk and <strong>must never be used on production machines</strong> because of
that.</p>
<div class="section" id="enabling-the-debugger">
<h2>Enabling the Debugger<a class="headerlink" href="#enabling-the-debugger" title="Permalink to this headline">¶</a></h2>
<p>You can enable the debugger by wrapping the application in a
<a class="reference internal" href="#werkzeug.debug.DebuggedApplication" title="werkzeug.debug.DebuggedApplication"><tt class="xref py py-class docutils literal"><span class="pre">DebuggedApplication</span></tt></a> middleware. Additionally there are
parameters to the <tt class="xref py py-func docutils literal"><span class="pre">run_simple()</span></tt> function to enable it because this
is a common task during development.</p>
<dl class="class">
<dt id="werkzeug.debug.DebuggedApplication">
<em class="property">class </em><tt class="descclassname">werkzeug.debug.</tt><tt class="descname">DebuggedApplication</tt><big>(</big><em>app</em>, <em>evalex=False</em>, <em>request_key='werkzeug.request'</em>, <em>console_path='/console'</em>, <em>console_init_func=None</em>, <em>show_hidden_frames=False</em>, <em>lodgeit_url=None</em><big>)</big><a class="headerlink" href="#werkzeug.debug.DebuggedApplication" title="Permalink to this definition">¶</a></dt>
<dd><p>Enables debugging support for a given application:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">werkzeug.debug</span> <span class="kn">import</span> <span class="n">DebuggedApplication</span>
<span class="kn">from</span> <span class="nn">myapp</span> <span class="kn">import</span> <span class="n">app</span>
<span class="n">app</span> <span class="o">=</span> <span class="n">DebuggedApplication</span><span class="p">(</span><span class="n">app</span><span class="p">,</span> <span class="n">evalex</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
</pre></div>
</div>
<p>The <cite>evalex</cite> keyword argument allows evaluating expressions in a
traceback’s frame context.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.9: </span>The <cite>lodgeit_url</cite> parameter was deprecated.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>app</strong> – the WSGI application to run debugged.</li>
<li><strong>evalex</strong> – enable exception evaluation feature (interactive
debugging). This requires a non-forking server.</li>
<li><strong>request_key</strong> – The key that points to the request object in ths
environment. This parameter is ignored in current
versions.</li>
<li><strong>console_path</strong> – the URL for a general purpose console.</li>
<li><strong>console_init_func</strong> – the function that is executed before starting
the general purpose console. The return value
is used as initial namespace.</li>
<li><strong>show_hidden_frames</strong> – by default hidden traceback frames are skipped.
You can show them by setting this parameter
to <cite>True</cite>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="using-the-debugger">
<h2>Using the Debugger<a class="headerlink" href="#using-the-debugger" title="Permalink to this headline">¶</a></h2>
<p>Once enabled and an error happens during a request you will see a detailed
traceback instead of a general “internal server error”. If you have the
<cite>evalex</cite> feature enabled you can also get a traceback for every frame in
the traceback by clicking on the console icon.</p>
<p>Once clicked a console opens where you can execute Python code in:</p>
<img alt="a screenshot of the interactive debugger" class="align-center" src="_images/debug-screenshot.png" />
<p>Inside the interactive consoles you can execute any kind of Python code.
Unlike regular Python consoles the output of the object reprs is colored
and stripped to a reasonable size by default. If the output is longer
than what the console decides to display a small plus sign is added to
the repr and a click will expand the repr.</p>
<p>To display all variables that are defined in the current frame you can
use the <cite>dump()</cite> function. You can call it without arguments to get a
detailed list of all variables and their values, or with an object as
argument to get a detailed list of all the attributes it has.</p>
</div>
<div class="section" id="pasting-errors">
<h2>Pasting Errors<a class="headerlink" href="#pasting-errors" title="Permalink to this headline">¶</a></h2>
<p>If you click on the <cite>Traceback</cite> title the traceback switches over to a text
based one. The text based one can be pasted to <a class="reference external" href="http://paste.pocoo.org/">paste.pocoo.org</a> with one
click.</p>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"><p class="logo"><a href="index.html">
<img class="logo" src="_static/werkzeug.png" alt="Logo"/>
</a></p>
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Debugging Applications</a><ul>
<li><a class="reference internal" href="#enabling-the-debugger">Enabling the Debugger</a></li>
<li><a class="reference internal" href="#using-the-debugger">Using the Debugger</a></li>
<li><a class="reference internal" href="#pasting-errors">Pasting Errors</a></li>
</ul>
</li>
</ul>
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
<li>Previous: <a href="test.html" title="previous chapter">Test Utilities</a></li>
<li>Next: <a href="wrappers.html" title="next chapter">Request / Response Objects</a></li>
</ul></li>
</ul>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/debug.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
© Copyright 2011, The Werkzeug Team.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
</html>
|