From 140baee3c965392bb2ce42c7e128368f6f523bf0 Mon Sep 17 00:00:00 2001 From: alandavl Date: Fri, 14 Jun 2024 11:40:22 -0300 Subject: [PATCH] feature: adding sentry to insigths project (#13) --- insights/settings.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/insights/settings.py b/insights/settings.py index d74903b..72d490b 100644 --- a/insights/settings.py +++ b/insights/settings.py @@ -14,7 +14,9 @@ from pathlib import Path import environ +import sentry_sdk from django.utils.log import DEFAULT_LOGGING +from sentry_sdk.integrations.django import DjangoIntegration environ.Env.read_env(env_file=(environ.Path(__file__) - 2)(".env")) @@ -230,6 +232,16 @@ # CORS CONFIG CORS_ORIGIN_ALLOW_ALL = True +# Sentry configuration + +USE_SENTRY = env.bool("USE_SENTRY", default=False) + +if USE_SENTRY: + sentry_sdk.init( + dsn=env.str("SENTRY_DSN"), + integrations=[DjangoIntegration()], + environment=env.str("ENVIRONMENT", default="develop"), + ) USE_EDA = env.bool("USE_EDA", default=False)