Interactive debugger and other Paste niceties

 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
#!/usr/bin/env python
"""Requires Paste and Werkzeug, use pip/easy_install to install::
$ pip Paste
$ pip Werkzeug
"""
import os
import sys

from werkzeug import run_simple, DebuggedApplication
from django.views import debug
from django.core.handlers.wsgi import WSGIHandler

def null_technical_500_response(request, exc_type, exc_value, tb):
    raise exc_type, exc_value, tb
debug.technical_500_response = null_technical_500_response

os.environ['DJANGO_SETTINGS_MODULE'] = 'YOURPROJ.settings'

from paste.debug.prints import PrintDebugMiddleware

app = WSGIHandler()
app = PrintDebugMiddleware(app)
app = DebuggedApplication(app, True)

if __name__ == '__main__':
    try:
        port = int(sys.argv[1])
    except (ValueError, IndexError):
        port = 8000
    run_simple('0.0.0.0', port, app, True)

More like this

  1. "Open file in Textmate"-support in werkzeug debugger browser view by grandfatha 1 year, 3 months ago
  2. pycallgraph by roppert 4 years, 3 months ago
  3. typygmentdown by ubernostrum 5 years, 9 months ago
  4. DebugFooter middleware with Pygments sql syntax highlighting by monolar 4 years, 11 months ago
  5. Complex Formsets, Redux by smagala 3 years, 2 months ago

Comments

(Forgotten your password?)