Skip to content

Commit

Permalink
feat: add sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelovicentegc committed Jun 6, 2020
1 parent 36283f4 commit ba2c11a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
django
djangorestframework
djangorestframework
sentry-sdk==0.14.4
19 changes: 18 additions & 1 deletion rtd/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,21 @@
'DEFAULT_RENDERER_CLASSES': (
'rest_framework.renderers.JSONRenderer',
)
}
}


# Sentry
# Enable this if on production
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration

SENTRY_DNS = os.environ.get('SENTRY_DNS')

sentry_sdk.init(
dsn=SENTRY_DNS,
integrations=[DjangoIntegration()],

# If you wish to associate users to errors (assuming you are using
# django.contrib.auth) you may enable sending PII data.
send_default_pii=True
)
6 changes: 6 additions & 0 deletions rtd/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@
from django.contrib import admin
from django.urls import path, include


def trigger_error(request):
division_by_zero = 1 / 0

urlpatterns = [
path('sentry-debug/', trigger_error),
path('admin/', admin.site.urls),
path('api/', include('api.urls')),
path('', include('frontend.urls')),

]

0 comments on commit ba2c11a

Please sign in to comment.