Available settings¶
The following settings can be added to a project’s Django settings file.
API_DEFAULT_AUTHENTICATORS
¶
The authenticator classes to use in all endpoints by default. Defaults to:
(
'api.authentication.DjangoSessionAuthenticator',
)
API_DEFAULT_AUTHORISERS
¶
The authoriser classes to use in all endpoints by default. Defaults to:
(
'api.authorisation.GuestReadOnlyOrDjangoUserAuthoriser',
)
API_DEFAULT_RPP
¶
The default number of items to return in a paginated list (defaults to 10).
API_URL_OVERRIDES
¶
A dictionary defining the alternative fields used as identifiers for models. For example, you probably don’t want users identified by primary key, so the default override definition looks like this:
{ 'auth.user': ('username', lambda o: o.username) }The key is the Django model, specified in <app_name>.<model_name> format. The value is a tuple containing the name of the field, which is passed to the REST URLconf generator, and a lambda function that obtains the value of that field from a given model instance.
API_DEBUG
¶
Defaults to the value of the site’s DEBUG
setting. Used to determine
whether exception info should be returned via the API endpoint, in the event of
an internal server error.