Sentry and Spotlight integration for Flask
Project description
Flask-Sentry
Sentry and Spotlight integration for Flask.
- Configure and initialize Sentry SDK for Flask and the browser
- Spotlight integration
- Properly handle debug mode
Installation
pip install flask-sentry
Usage
from flask import app
from flask_sentry import Sentry
app = Flask(__name__)
Sentry(app, dsn="http://DSN")
Use init_sentry() in your template:
<!DOCTYPE html>
<html>
<head>
{{ init_sentry() }}
</head>
</html>
Using spotlight
Install spotlight:
npm install @spotlightjs/spotlight
Run spotlight before starting your app:
flask spotlight
Include the spotlight init script in your template, either using init_sentry() or only spotlight using init_spotlight().
<!DOCTYPE html>
<html>
<head>
{{ init_spotlight() }}
</head>
</html>
Will only render something if spotlight is enabled.
Spotlight is automatically enabled in debug mode when a spotlight server is detected. Otherwise, spotlight is disabled.
Configuration
| Config key | Extension argument | Description | Default |
|---|---|---|---|
| SENTRY_DSN | dsn | Sentry DSN | |
| SENTRY_* | **kwargs | Any options available in the sentry_sdk.init() function | |
| SENTRY_DEBUG_ENABLED | debug_enabled | Whether to enable sending to the dsn in debug | False |
| SPOTLIGHT_URL | spotlight_url | True or a spotlight url to enable spotlight | True |
| SPOTLIGHT_DETECT | detect_spotlight | Whether to detect if the spotlight sidecar is running before enabling spotlight | True |
| SPOTLIGHT_CMD | spotlight_cmd | The spotlight cmd to launch the sidecar | npx @spotlightjs/spotlight |
| SPOTLIGHT_SCRIPT | spotlight_script | The spotlight script in the browser | Currently recommended url |
| SENTRY_BROWSER | browser | Whether to enable sentry sdk in the browser | True |
| SENTRY_BROWSER_OPTIONS | browser_options | Options for the browser sdk | {} |
| SENTRY_BROWSER_TRACING | browser_tracing | Whether to enable tracing in the browser | True |
| SENTRY_BROWSER_REPLAY | browser_replay | Whether to enable session replay in the browser | True |
| SENTRY_BROWSER_SCRIPT | browser_script | Sentry sdk script url (do not load script if None) | Currently recommended url |
| SENTRY_BROWSER_SCRIPT_INTEGRITY | browser_script_integrity | Integrity hash for the sdk script | Hash for currently recommended url |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flask_sentry-0.2.0.tar.gz.
File metadata
- Download URL: flask_sentry-0.2.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46575761af40a48db55eab71675097eecd5a49f33a398c49cb3741c44d5fb800
|
|
| MD5 |
2112eb26df63222a2140613dceec1d2c
|
|
| BLAKE2b-256 |
3e04115fc6adc881e13d078ff9c102c7b666bd4dfed165978d66bda18fab07d7
|
File details
Details for the file flask_sentry-0.2.0-py3-none-any.whl.
File metadata
- Download URL: flask_sentry-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50c45f726eabbaf2010b81a78ae1c70f8fbfebb453432856fced0e18d8e9a745
|
|
| MD5 |
f2e466b506c489e402627823dd2fb56d
|
|
| BLAKE2b-256 |
bb0be768332f13c5b5e2823799f61bdce8aa46a4f860dd3f59cb823eb7eacca4
|