Mike Shultz
Mike Shultz

Reputation: 1418

Selectively blocking Django error e-mails

Is there a simple way to keep Django from sending error E-mails for certain views or URLs?

I noticed today, that there are some errors that happen on our login view. And since Django includes POST data in these E-mails, it's E-mailing cleartext passwords. This is obviously not ideal and I'd rather not have to kill the whole system to prevent this.

Upvotes: 0

Views: 66

Answers (2)

Peter DeGlopper
Peter DeGlopper

Reputation: 37344

Django allows you to either specify sensitive variables to omit from the traceback on a per-view basis, or write your own filtering logic and tie that in for all email notifications. I think that was first added in 1.4. The docs have good examples:

https://docs.djangoproject.com/en/dev/howto/error-reporting/#sensitive_variables

https://docs.djangoproject.com/en/dev/howto/error-reporting/#custom-error-reports

Upvotes: 2

George Cummins
George Cummins

Reputation: 28906

Django does not provide a way to filter email on a per-view or per-URL basis.

There are two common ways to deal with this situation:

  1. Fix the condition causing the error
  2. Filter the email on the receiving end

Upvotes: 0

Related Questions