Skip to content

Commit

Permalink
Merge pull request #10 from weni-ai/feature/adding-sentry
Browse files Browse the repository at this point in the history
feature: adding sentry
  • Loading branch information
AlanJaeger authored Oct 18, 2024
2 parents d1fde07 + 0731495 commit 341f48c
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 2 deletions.
11 changes: 11 additions & 0 deletions apip/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from pathlib import Path

import environ
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
Expand Down Expand Up @@ -58,6 +60,7 @@
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"apip.middlewares.subdomain_mock.SubdomainMockMiddleware",
"sentry_sdk.integrations.django.middleware.SentryMiddleware",
]

ROOT_URLCONF = "apip.urls"
Expand Down Expand Up @@ -106,7 +109,15 @@
},
]

# SENTRY
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"),
)
# Internationalization
# https://docs.djangoproject.com/en/5.0/topics/i18n/

Expand Down
56 changes: 54 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ requests = "^2.31.0"
django-ace = "^1.32.4"
psycopg2 = "^2.9.9"
django-cors-headers = "^4.3.1"
sentry-sdk = "^2.16.0"


[tool.poetry.group.dev.dependencies]
Expand Down

0 comments on commit 341f48c

Please sign in to comment.