title: Why isn't Flask giving me an interactive debugger?
body: <p>Here's a simple Flask app with a syntax error (it should be <code>sys.version</code>, not <code>sys.version()</code></p>
  
  <pre><code>from flask import Flask, url_for, request, render_template
  import sys
  
  app = Flask(__name__)
  app.config.from_object(__name__)
  
  @app.route('/')
  def index():
      version = sys.version()
      return "This is the index page.  Python version info: {}".format(version)
  
  if __name__ == '__main__':
      app.run(debug=True)
  </code></pre>
  
  <p>When I run it locally and try to access <a href="http://localhost:5000" rel="nofollow noreferrer">http://localhost:5000</a>, I get the nice Werkzeug debugger:</p>
  
  <p><a href="https://i.stack.imgur.com/IQJmH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IQJmH.png" alt="enter image description here"></a></p>
  
  <p>but when I run it on a remote server (Apache 2.4.17, mod_wsgi 4.4.21), I only get a generic 500 error page:</p>
  
  <p><a href="https://i.stack.imgur.com/AI420.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AI420.png" alt="enter image description here"></a></p>
  
  <p>I've tried various things to make this work:</p>
  
  <ul>
  <li>set <code>app.debug = True</code> right after <code>app = Flask(__name__)</code></li>
  <li>based on <a href="https://stackoverflow.com/questions/10566107/activating-the-flask-debugger-when-running-under-mod-wsgi">this link</a>, I tried adding this code as well:</li>
  </ul>
  
  <p><code>from werkzeug.debug import DebuggedApplication
  application = DebuggedApplication(app, True)</code></p>
  
  <p>but nothing seems to help.</p>
  
  <p>I know that the debugger doesn't work in forked environments, but according to <a href="https://stackoverflow.com/questions/10566107/activating-the-flask-debugger-when-running-under-mod-wsgi#comment20593300_10568135">this link</a>, the default mode for mod_wsgi is to <strong>not</strong> be forked.  My Apache config is:</p>
  
  <pre><code>WSGIDaemonProcess flasktest user=david group=devgrp threads=1 python-path=/apps/www/80/wsgi-scripts/FlaskTest:/apps/.virtualenvs/flasktest/lib/python3.4/site-packages
  </code></pre>
  
  <p>So why can't I get the pretty debugger?</p>
  
  <p><strong>EDIT:</strong> Here's the modified file with my additions (that aren't working)</p>
  
  <pre><code>from flask import Flask
  import sys
  
  app = Flask(__name__)
  app.config.from_object(__name__)
  app.debug = True
  
  from werkzeug.debug import DebuggedApplication
  application = DebuggedApplication(app, True)  
  
  @app.route('/')
  def index():   
      version = sys.version()
      return "This is the index page.  Python version info: {}".format(version)
  
  if __name__ == '__main__':
      app.run(debug=True)   
  </code></pre>