{% extends "sentry/partial/client_config/python_base.html" %} {% load i18n %} {% block inner %}
{% trans "Create an instance of the client:" %}
import raven client = raven.Client( dsn='{% if dsn %}{{ dsn }}{% else %}SENTRY_DSN{% endif %}', # inform the client which parts of code are yours # include_paths=['my.app'] # include_paths=[__name__.split('.', 1)[0]], # pass along the version of your application # release='1.0.0' # release=raven.fetch_package_version('my-app') # release=raven.fetch_git_sha(os.path.dirname(__file__)), )
{% 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 %}