I'm trying to use the werkzeug debugger, but despite installing it as recommended, I just get the normal django error page.

from my passenger_wsgi.py:

import django.core.handlers.wsgi
from werkzeug.debug import DebuggedApplication

application = django.core.handlers.wsgi.WSGIHandler()
application = DebuggedApplication(application, evalex=True)

I'm largely constrained to running my django app (even in development) through passenger, not manage.py.

Is there any way I can get the werkzeug debugger to work under these conditions? Could I, for instance prevent Django from intercepting the errors itself?

up vote 7 down vote accepted

You can disable Django exception handling with DEBUG_PROPAGATE_EXCEPTIONS setting. Then Werkzeug will be able to handle it.

That's easy with the django-command-extensions. The runserver_plus command features werkzeug debugger.

  • Thanks, but I can't use manage.py. I have to run my app through passenger. – Marcin Jul 24 '11 at 14:08
  • Can I not assume you need debugging only in your development environment where you are not tied to passenger? – shanyu Jul 24 '11 at 14:14
  • No, for various reasons I develop in a hosted environment which constrains me to use passenger. – Marcin Jul 24 '11 at 14:15
  • By the way, you are not intending to use werkzeug debugger on your production system, right? It allows code execution.. – shanyu Jul 24 '11 at 14:19
  • No way, dude ;) – Marcin Jul 24 '11 at 14:33

This is because Django is intercepting any errors and converting them to an error page long before django.core.handlers.wsgi.WSGIHandler() returns anything. You will not be able to get it working that way as application errors within your Django site will never propagate all the way back up to the top level.

  • OK, so is there any way to get the two to work together, or am I out of luck? – Marcin Jul 24 '11 at 11:07
  • 1
    You can, just not the way you are doing it. A bit of Googling yields 'voices.canonical.com/isd/?p=116';. Am sure there is other information out there as well if you look. – Graham Dumpleton Jul 24 '11 at 11:44
  • Thanks - I assume you don't have any experience with that approach that you would care to share? – Marcin Jul 24 '11 at 13:01

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.