question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Disable emailing 503 errors to admins while maintenance mode is enabled

See original GitHub issue

Python version 3.8

Django version 3.1.4

Package version 0.15.1

I think it would be nice to have a setting like this:

# Don't send 503 error emails to admins while maintenance mode is active
MAINTENANCE_MODE_DISABLE_503_EMAILS = True

By default, Django sends emails to site admins for HTTP errors >= 500. It would be nice if this could be turned off while maintenance mode is on, since these errors would be expected at that time.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
alicenicommented, Sep 24, 2021

@aliceni81 you can upgrade to 0.16.1.

Thx!

1reaction
aliceni81commented, Aug 19, 2021

settings.MAINTENANCE_MODE is static and cannot be changed when run “maintenance_mode <on|off>”. So if I run the command or by other methods to change the maintenance mode, the error email still will be sent to admin. Will this filter be improved in the future? something like the following codes?

class RequireNotMaintenanceMode503(logging.Filter): “”" Filters out 503 errors if maintenance mode is activated. “”"

def filter(self, record):
    """
    Return False if maintenance mode is on and
    the given record has a status code of 503.
    """
    status_code = getattr(record, 'status_code', None)

    # If maintenance mode is defined in settings, it has priority.
    maintenance_mode = None
    if settings.MAINTENANCE_MODE is not None:
        maintenance_mode = settings.MAINTENANCE_MODE
    else:
        backend = get_maintenance_mode_backend()
        maintenance_mode = backend.get_value()

    if maintenance_mode and status_code == 503:
        return False
    return True
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix the HTTP Error 503 Service Unavailable - Kinsta
1. Temporarily Deactivate Your WordPress Plugins. One of the most common causes of the 503 error in WordPress is plugin compatibility issues. ...
Read more >
WP Maintence mode with Hide My WP | WordPress.org
It seems that WP Maintenance mode is not working with Hide My WP. The maintenance page shows error 503 and admin also can't...
Read more >
How to fix a 503 error on WordPress? - Maintenance WP
First, there is this blank page. A blank page with some not very understandable indications. The number 503 appears here, and the following ......
Read more >
Solved: Magento 2 Service Temporarily Unavailable (Error 503)
It may happen because the server is under the maintenance mode or is simply ... the error log if you see a message...
Read more >
How To Fix GoDaddy's 503 Service Unavailable Error [2022]
1. Deactivate all plugins 1 by 1 then reactivate them to see which one's slowing down your website and causing 503 service unavailable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found