<commit_before>Configuring Django
==================

Setup
-----

Using the Django integration is as simple as adding :mod:`opbeat_python.contrib.django` to your installed apps::

        INSTALLED_APPS = (
            'opbeat_python.contrib.django',
        )

Additional settings for the client are configured using ``OPBEAT_<setting name>``::

    OPBEAT_PROJECT_ID = '<id>'
    OPBEAT_ACCESS_TOKEN = '<token>'

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

    from opbeat_python.contrib.django.models import client

    client.captureException()


Integration with :mod:`logging`
-------------------------------

To integrate with the standard library's :mod:`logging` module:

Django 1.3+
~~~~~~~~~~~~~~

::

    LOGGING = {
        'version': 1,
        'disable_existing_loggers': True,
        'root': {
            'level': 'WARNING',
            'handlers': ['opbeat_python'],
        },
        'formatters': {
            'verbose': {
                'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
            },
        },<commit_msg>Slighly changed the wording on how to get started with django.<commit_after>Configuring Django
==================

Setup
-----

Using the Django integration is as simple as adding :mod:`opbeat_python.contrib.django` to your installed apps::

        INSTALLED_APPS = (
            'opbeat_python.contrib.django',
        )

Remember to add the following settings to settings.py::

    OPBEAT_PROJECT_ID = '<id>'
    OPBEAT_ACCESS_TOKEN = '<token>'

You'll find your project id and access token under ``Project Settings`` on opbeat.com

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

..     from opbeat_python.contrib.django.models import client

..     client.captureException()


Integration with :mod:`logging`
-------------------------------

To integrate with the standard library's :mod:`logging` module:

Django 1.3+
~~~~~~~~~~~~~~

::

    LOGGING = {
        'version': 1,
        'disable_existing_loggers': True,
        'root': {
            'level': 'WARNING',
            'handlers': ['opbeat_python'],
        },
        'formatters': {
            'verbose': {
                'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
            },
        },
{'fraction_non_alphanumeric': 0.16787388155091607, 'fraction_numerical': 0.0025564550489987218, 'mean_word_length': 2.509715994020927, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5411075', 'n_tokens_mistral': 691, 'n_tokens_neox': 660, 'n_words': 183}