import os

import sentry_sdk
from flask import Flask
from sentry_sdk.integrations.flask import FlaskIntegration
from sentry_sdk.integrations.redis import RedisIntegration
from sentry_sdk.integrations import logging

from app import create_app

sentry_sdk.init(
    dsn=os.environ['SENTRY_DSN'],
    integrations=[FlaskIntegration(), RedisIntegration()],
    environment=os.environ['NOTIFY_ENVIRONMENT'],
    attach_stacktrace=True,
    traces_sample_rate=0.00005  # avoid exceeding rate limits in Production
)

sentry_sdk.set_level('error')  # only record error logs or exceptions
logging.ignore_logger('notifications_python_client.*')  # ignore logs about 404s, etc.

application = Flask('app')

create_app(application)

@@ -237,16 +237,51 @@
 te_app%0A%0A
+if 'SENTRY_DSN' in os.environ:%0A    
 sentry_s
@@ -289,16 +289,20 @@
 k.init(%0A
+    
     dsn=
@@ -323,24 +323,28 @@
 NTRY_DSN'%5D,%0A
+    
     integrat
@@ -390,16 +390,20 @@
 ion()%5D,%0A
+    
     envi
@@ -440,24 +440,28 @@
 IRONMENT'%5D,%0A
+    
     attach_s
@@ -476,16 +476,20 @@
 e=True,%0A
+    
     trac
@@ -560,81 +560,19 @@
 ion%0A
-)%0A%0Asentry_sdk.set_level('error')  # only record error logs or exceptions%0A
+    )%0A%0A    
 logg

Tweak Sentry config to work in development