how to NOT receive email error reports for HTTP 503 status code?

I configured Error Reporting for my django app so it will send an report by email to those who i specified in ADMINS list in (see this). it works perfectly well.

Based on official django documentation, it will trigger whenever a HTTP 500 or greater status code raised:

When DEBUG is False, Django will email the users listed in the ADMINS
setting whenever your code raises an unhandled exception and results
in an internal server error (strictly speaking, for any response with
an HTTP status code of 500 or greater)

How to override this behavior?

To be specific, i want receive emails just when HTTP 500 raised.

More Details:

Sometimes i enable maintenance mode in my app, so each request will responded by a HTTP 503 code, and since 503 > 500 , django sends me an email for each request! i wanna somehow override this behavior.

I don’t know if there’s an easier way of doing this, but one possibility would be to change your logging configuration. I would think you could create a filter that would filter out the maintenance mode messages from being logged (emailed). (You’ll then also need to provide a custom logger definition to use it.)

I have very similar issue.
@KenWhitesell could you elaborate a bit more in detail?
Thank you.

Not much more detail to add beyond the Django logging docs.

The “email admin in case of error” function is handled by the AdminEmailHandler. You can configure that with a custom Filter to exclude any error message for which you don’t want to generate an email.

Thank you, that was helpful.