title: How can I test whether Django is running in debug mode?
body: <p>My settings file has:</p>
  
  <pre><code>DEBUG = True
  </code></pre>
  
  <p>The obvious method:</p>
  
  <pre><code>if DEBUG:
      print 'debug'
  </code></pre>
  
  <p>Does not seem to work:</p>
  
  <pre><code>global name 'DEBUG' is not defined
  </code></pre>