Django

The Django integration adds support for the Django framework. For more information, see our Django integration guide.

Copied
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration

sentry_sdk.init(
    dsn='https://examplePublicKey@o0.ingest.sentry.io/0',
    integrations=[DjangoIntegration()]
)

Options

transaction_style

The transaction_style option can be used to change the format of transaction name. There are two options available:

  • url (default) - formats based on the route (e.g. /myurl/{myid})
  • function_name - formats based on the view function name (e.g. my_view_function)
Copied
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration

sentry_sdk.init(
    dsn='https://examplePublicKey@o0.ingest.sentry.io/0',
    integrations=[
        DjangoIntegration(
            transaction_style='url',
        ),
    ]
)