Werkzeug Debugger in Django

(Thanks monkey patching). Ugly but works: using the werkzeug debugger with django.

Now digg/reddit it ;-)

4 Responses to “Werkzeug Debugger in Django”

  1. Cool stuff, I asked about this in a comment on your last blog post and today it’s already patched in!

    Comment by Eric Florenzano — Monday, December 10th, 2007 @ 8:21 pm
  2. I’ve added:

    import django
    from django.core.servers.basehttp import AdminMediaHandler
    [...]
    if __name__ == '__main__':
        path = django.__path__[0] + '/contrib/admin/media/'
        run_simple('localhost', 8080, DebuggedApplication(AdminMediaHandler(WSGIHandler(),path), True))

    now it also serves my admin-media files correctly in the development environment, this is how django would do it, when the dev-server is used.

    Comment by Arne — Saturday, December 15th, 2007 @ 2:34 pm
  3. […] после одной отличной новости можно значительно облегчить себе […]

    Comment by Amazon byteflow: Дебаг Джанги — Saturday, December 15th, 2007 @ 10:32 pm
  4. only this modified version worked for me in Windows:

    #!/usr/bin/env python
    import os, sys
    from os.path import abspath, dirname
    
    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'] = 'settings'
    
    path = os.path.abspath(dirname(dirname(abspath(__file__))))
    sys.path.append(path)
    
    if __name__ == '__main__':
        run_simple('localhost', 8080, DebuggedApplication(WSGIHandler(), True), True)
    Comment by Nick — Wednesday, December 19th, 2007 @ 4:40 pm

Leave a Reply

cogitations driven by wordpress