- You can run
sentry_sdk.init() without arguments again to disable the SDK completely. Your
capture_exception calls will become no-ops.
- You do not have to run
init() before creating the Flask app. You can run it almost anywhere during import time.
With that being said I would recommend keeping the SDK enabled in development mode, but with a few changes:
from __future__ import print_function
app = Flask(__name__)
# production init
So you can already see in development which events would be sent to sentry, and how they look like. You could probably make a function that prints the event (a simple JSON-serializable dictionary) print a bit less (and more nicely), but I think you get the general idea.