Unverified Commit f9038522 authored by Thom Wiggers's avatar Thom Wiggers 📐
Browse files

Log production exceptions to Slack

parent 60543df9
......@@ -8,6 +8,14 @@ See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/
import os
from django.utils.log import DEFAULT_LOGGING
from . import settings
INSTALLED_APPS = settings.INSTALLED_APPS
INSTALLED_APPS.remove('django_template_check')
INSTALLED_APPS.append('django_slack')
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.abspath(os.path.join(
os.path.dirname(os.path.abspath(__file__)),
......@@ -113,3 +121,17 @@ if os.environ.get('DJANGO_EMAIL_HOST'):
X_FRAME_OPTIONS = 'DENY'
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_BROWSER_XSS_FILTER = True
# Slack configuration
SLACK_TOKEN = os.environ.get('DJANGO_SLACK_TOKEN')
SLACK_CHANNEL = '#django'
SLACK_USERNAME = 'Concrexit'
SLACK_ICON_EMOJI = ':pingu:'
SLACK_FAIL_SILENTLY = True
LOGGING = DEFAULT_LOGGING
LOGGING['handlers']['slack-error'] = {
'level': 'ERROR',
'class': 'django_slack.log.SlackExceptionHandler',
}
LOGGING['loggers']['django']['handlers'].append('slack-error')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment