{% extends "sentry/partial/client_config/python_base.html" %} {% load i18n %} {% block inner %}
{% 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 ZeroDivisionError: 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, client=client)
{% trans "If you wish to test your connection to the server, you can use the raven test command:" %}
raven test {% if dsn %}{{ dsn }}{% else %}SENTRY_DSN{% endif %}{% endblock %}