Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are a bunch of ways to do it, but the most straightforward is to simply use the <a href="https://docs.python.org/2/library/pdb.html" rel="noreferrer">Python debugger</a>. Just add following line in to a Django view function:</p> <pre><code>import pdb; pdb.set_trace() </code></pre> <p>If you try to load that page in your browser, the browser will hang and you get a prompt to carry on debugging on actual executing code.</p> <p>However there are other options (I am not recommending them):</p> <pre><code>* return HttpResponse({variable to inspect}) * print {variable to inspect} * raise Exception({variable to inspect}) </code></pre> <p>But the Python Debugger (pdb) is highly recommended for all types of Python code. If you are already into pdb, you'd also want to have a look at <a href="http://pypi.python.org/pypi/ipdb/" rel="noreferrer"><strong>IPDB</strong></a> that uses <a href="http://ipython.org/" rel="noreferrer"><strong>ipython</strong></a> for debugging.</p> <p>Some more useful extension to pdb are</p> <p><a href="https://pypi.python.org/pypi/pdbpp/" rel="noreferrer"><strong>pdb++</strong></a>, suggested by <a href="https://stackoverflow.com/users/5792269/antash">Antash</a>.</p> <p><a href="https://pypi.python.org/pypi/pudb" rel="noreferrer"><strong>pudb</strong></a>, suggested by <a href="https://stackoverflow.com/users/5081188/patdujour">PatDuJour</a>.</p> <p><a href="https://mike.tig.as/blog/2010/09/14/pdb/" rel="noreferrer"><strong>Using the Python debugger in Django</strong></a>, suggested by <a href="https://stackoverflow.com/users/884640/seafangs">Seafangs</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload