{% load i18n %}

{% blocktrans with 'https://github.com/getsentry/raven-python' as link %}Start by installing raven-python:{% endblocktrans %}

pip install raven

{% trans "Create an instance of the client:" %}

from raven import Client

client = Client('{% if dsn %}{{ dsn }}{% else %}SENTRY_DSN{% endif %}')

{% trans "Now call out to the raven client to capture events:" %}

# {% trans "record a simple message" %}
client.captureMessage('hello world!')

# {% trans "capture an exception" %}
try:
    1 / 0
except DivisionError:
    client.captureException()

{% trans "If you want to wrap a WSGI app to record uncaught exceptions, Raven provides a middleware for that:" %}

from raven.middleware import Sentry

application = Sentry(application)

{% blocktrans with 'http://raven.readthedocs.org' as link %}For more information on other uses of Raven with Python, please see the official documentation for raven-python.{% endblocktrans %}