From b2d44e83b4a386ea15f4ba2390fa13860c07498e Mon Sep 17 00:00:00 2001 From: klmp200 Date: Sat, 6 Oct 2018 03:37:36 +0200 Subject: [PATCH] debug: add sentry support --- README.md | 4 ++++ requirements.txt | 1 + sith/settings.py | 8 ++++++++ 3 files changed, 13 insertions(+) diff --git a/README.md b/README.md index e4e66955..2384642a 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,10 @@ To start working on the project, just run the following commands: To start the simple development server, just run `python3 manage.py runserver` +### Logging errors with sentry + +To connect the app to sentry.io, you must set the variable SENTRY_DSN in your settings custom. It's composed of the full link given on your sentry project + ### Generating documentation There is a Doxyfile at the root of the project, meaning that if you have Doxygen, you can run `doxygen Doxyfile` to diff --git a/requirements.txt b/requirements.txt index d06618de..743cb8a8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,4 +17,5 @@ django-ordered-model django-simple-captcha python-dateutil pygraphviz +sentry_sdk # mysqlclient diff --git a/sith/settings.py b/sith/settings.py index af52ebcb..2991efe8 100644 --- a/sith/settings.py +++ b/sith/settings.py @@ -39,6 +39,8 @@ https://docs.djangoproject.com/en/1.8/ref/settings/ import os import sys import binascii +import sentry_sdk +from sentry_sdk.integrations.django import DjangoIntegration from django.utils.translation import ugettext_lazy as _ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -553,6 +555,8 @@ SITH_MAILING_FETCH_KEY = "IloveMails" SITH_GIFT_LIST = [("AE Tee-shirt", _("AE tee-shirt"))] +SENTRY_DSN = "" + try: from .settings_custom import * @@ -583,3 +587,7 @@ if DEBUG: if "test" in sys.argv: CAPTCHA_TEST_MODE = True + +if SENTRY_DSN: + # Connection to sentry + sentry_sdk.init(dsn=SENTRY_DSN, integrations=[DjangoIntegration()])