{ "html": "
\n

Installation

\n

If you haven’t already, start by downloading Raven. The easiest way is\nwith pip:

\n
pip install raven --upgrade\n
\n
\n
\n\n\n
\n

Setup

\n

Using the Django integration is as simple as adding\nraven.contrib.django.raven_compat to your installed apps:

\n
INSTALLED_APPS = (\n    'raven.contrib.django.raven_compat',\n)\n
\n
\n
\n

Note

\n

This causes Raven to install a hook in Django that will\nautomatically report uncaught exceptions.

\n
\n

Additional settings for the client are configured using the\nRAVEN_CONFIG dictionary:

\n
import os\nimport raven\n\nRAVEN_CONFIG = {\n    'dsn': '___DSN___',\n    # If you are using git, you can also automatically configure the\n    # release based on the git info.\n    'release': raven.fetch_git_sha(os.path.abspath(os.pardir)),\n}\n
\n
\n

Once you’ve configured the client, you can test it using the standard Django\nmanagement interface:

\n
python manage.py raven test\n
\n
\n

You’ll be referencing the client slightly differently in Django as well:

\n
from raven.contrib.django.raven_compat.models import client\n\nclient.captureException()\n
\n
\n
\n", "link": "https://docs.getsentry.com/clients/python/integrations/django/", "id": "python-django", "name": "Django" }