diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 74e607268705a4ded9dfcf5322230921a9f6ba3b..54f064594cd7f467ed5cf9e0f45893424e7fd210 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -17,6 +17,8 @@ Added Changed ~~~~~~~ + +* Do not log or e-mail ALLOWED_HOSTS violations * Replace dev.sh helper script with tox environments. Fixed diff --git a/aleksis/core/settings.py b/aleksis/core/settings.py index 442d7b45f6d9f111a7a3c81d1b6edf3410ee185d..a41b1913c9ea41bef202897c3555722e14605516 100644 --- a/aleksis/core/settings.py +++ b/aleksis/core/settings.py @@ -781,11 +781,21 @@ BLEACH_STRIP_COMMENTS = True LOGGING = { "version": 1, "disable_existing_loggers": False, - "handlers": {"console": {"class": "logging.StreamHandler", "formatter": "verbose"},}, + "handlers": { + "console": {"class": "logging.StreamHandler", "formatter": "verbose"}, + "null": {"class": "logging.NullHandler"}, + }, "formatters": {"verbose": {"format": "%(levelname)s %(asctime)s %(module)s: %(message)s"}}, "root": {"handlers": ["console"], "level": _settings.get("logging.level", "WARNING"),}, + "loggers": {}, } +if not _settings.get("logging.disallowed_host", False): + LOGGING["loggers"]["django.security.DisallowedHost"] = { + "handlers": ["null"], + "propagate": False, + } + # Rules and permissions GUARDIAN_RAISE_403 = True