.. _configuration:

=============
Configuration
=============

.. index::
    single: urls.py
    single: settings.py
    single: autodiscover

settings.py
===========

To enable django-authority you just need to add the package to your
``INSTALLED_APPS`` setting within your ``settings.py``::

    # settings.py
    INSTALLED_APPS = (
        ...
        'authority',
    )

Make sure your ``settings.py`` contains the following settings to enable the
context processors::

    TEMPLATE_CONTEXT_PROCESSORS = (
        'django.core.context_processors.auth',
        'django.core.context_processors.debug',
        'django.core.context_processors.i18n',
        'django.core.context_processors.media',
        'django.core.context_processors.request',
    )

django-authority defaults to using a smart cache when checking permissions.
This can be disabled by adding the following line to ``settings.py``::

    AUTHORITY_USE_SMART_CACHE = False

urls.py
=======

You also have to modify your root URLConf (e.g. ``urls.py``) to include the
app's URL configuration and automatically discover all the permission
classes you defined::

    from django.contrib import admin
    import authority

    admin.autodiscover()
    authority.autodiscover()

    # ...

    urlpatterns += patterns('',
        (r'^authority/', include('authority.urls')),
    )

If you're using Django 1.1 this will automatically add a `site-wide action`_
to the admin site which can be removed as shown here: :ref:`handling-admin`.

That's all (for now).

.. _site-wide action: http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/
