summaryrefslogtreecommitdiff
path: root/example_project
diff options
context:
space:
mode:
Diffstat (limited to 'example_project')
-rw-r--r--example_project/celery_app.py.sample3
-rw-r--r--example_project/settings.py19
2 files changed, 20 insertions, 2 deletions
diff --git a/example_project/celery_app.py.sample b/example_project/celery_app.py.sample
index 23c050732..81000bc14 100644
--- a/example_project/celery_app.py.sample
+++ b/example_project/celery_app.py.sample
@@ -1,6 +1,7 @@
import os
from celery import Celery
+
# change example_project with your project name
project_name = "example_project"
@@ -10,4 +11,4 @@ os.environ.setdefault('DJANGO_SETTINGS_MODULE', project_name + '.settings')
app = Celery(project_name)
app.config_from_object('django.conf:settings', namespace='CELERY')
-app.autodiscover_tasks() \ No newline at end of file
+app.autodiscover_tasks()
diff --git a/example_project/settings.py b/example_project/settings.py
index b858c5907..a5d1d3b3e 100644
--- a/example_project/settings.py
+++ b/example_project/settings.py
@@ -6,6 +6,13 @@ import os
import sys
from importlib import import_module
+try:
+ import sentry_sdk
+ from sentry_sdk.integrations.celery import CeleryIntegration
+ from sentry_sdk.integrations.django import DjangoIntegration
+except ImportError:
+ sentry_sdk = None
+
DEBUG = False
DEBUG_TOOLBAR = False
DEBUG_TO_CONSOLE = False
@@ -286,8 +293,8 @@ MAX_UPLOAD_SIZE = 100 # in Mo
DOT_BINARY = "/usr/bin/dot"
TEST_RUNNER = 'ishtar_common.tests.ManagedModelTestRunner'
-
CELERY_BROKER_URL = ''
+SENTRY_ID = None
try:
from local_settings import *
@@ -392,3 +399,13 @@ if 'test' in sys.argv:
if not DEBUG:
# persistent connection
DATABASES['default']['CONN_MAX_AGE'] = 600
+
+if SENTRY_ID and sentry_sdk:
+ sentry_integrations = [DjangoIntegration()]
+ if USE_BACKGROUND_TASK:
+ sentry_integrations.append(CeleryIntegration())
+ sentry_sdk.init(
+ dsn=SENTRY_ID,
+ integrations=sentry_integrations,
+ send_default_pii=True
+ )