Marcin
Marcin

Reputation: 49826

Debugging Django with Werkzeug under WSGI/Passenger - problems

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?

Upvotes: 5

Views: 1503

Answers (3)

Ilia Novoselov
Ilia Novoselov

Reputation: 363

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

Upvotes: 8

shanyu
shanyu

Reputation: 9716

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

Upvotes: 2

Graham Dumpleton
Graham Dumpleton

Reputation: 58523

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.

Upvotes: 1

Related Questions