Python
Capture exceptions from Django, Flask, FastAPI, and Celery with sentry-sdk pointed at Epure.
Use official sentry-sdk. Point dsn at your Epure host. No Epure Python package.
Use this guide when the process is Python: Django, Flask, FastAPI, Starlette, Celery, scripts. Do not use this for JS/TS (→ Browser, Node, Next.js). Full map: Pick your SDK.
Capture exceptions in Python
Install sentry-sdk, call sentry_sdk.init once at startup, then throw or capture_exception. Python fixtures exercise store (POST /store/) and are E2E tested; envelope also works when the SDK sends it.
Grouping uses raw frames (file, function, line as sent). No Python symbol server.
How do I install sentry-sdk?
pip install sentry-sdkKeep Django / Flask / FastAPI integrations from the official SDK. Only dsn changes.
Init the Python SDK
Call once at process start, before the framework serves traffic.
import sentry_sdk
sentry_sdk.init(
dsn="http://YOUR_PUBLIC_KEY@localhost:8080/YOUR_PROJECT_ID",
environment="local",
release="my-api@0.0.0",
traces_sample_rate=0.0,
profiles_sample_rate=0.0,
)| Option | Value |
|---|---|
dsn | Required: public key + Epure host + project UUID |
environment | Tag for the dashboard filter strip |
release | Version string on the issue |
traces_sample_rate | 0; transactions discarded |
profiles_sample_rate | 0; profiles discarded |
Framework integrations (DjangoIntegration, FastAPI, Celery) stay. Point them at the same DSN. Celery workers can share the web project or use a second one.
How do I capture handled errors?
try:
1 / 0
except Exception as exc:
sentry_sdk.capture_exception(exc)
raiseWhat should I see after ingest?
202, then an issue whose title matches the exception type and value, with a stack as sentry-sdk sent it.
Why does Python never send?
| What you see | What to do |
|---|---|
| 401 / 403 | Recopy the DSN from Settings → SDK connection |
| 202, empty Issues | Match the environment chip to environment |
| Worker throws missing | Init the SDK in the worker process, not only the web app |
No SDK yet? Other runtimes has a store curl, or use Try ingest.
Next
- Other runtimes: Go, Ruby, PHP, Java, .NET, store curl
- Verify
- Ingest API
- Pick your SDK
Does Epure demangle Python stacks?
No. Symbolication is JS/TS sourcemaps only. Python issues group on file, function, and line as sentry-sdk sends them. That is enough for most Django and FastAPI frames. Confirm with Verify.
Which wire path does Python use?
Python fixtures use the legacy store path (POST /store/) and are E2E tested. Envelope also works when the SDK sends it. Auth: Authentication.
Are traces stored?
No. Set traces_sample_rate and profiles_sample_rate to 0. Transaction and profile items are discarded on ingest. Exception events plus breadcrumbs stay.