Settings

This page is the reference for the MOMOTOR_BROKER dictionary in your Django settings. See Connect your Django project to a broker for a minimal working configuration.

MOMOTOR_BROKER

A dictionary with the connection settings for the Momotor broker. API_KEY and API_SECRET are required. Every other value is optional.

Example:

MOMOTOR_BROKER = {
    'HOST': 'broker.example.com',
    'PORT': 50052,
    'USE_SSL': 'yes',

    'API_KEY': 'momotor-api-key',
    'API_SECRET': 'momotor-api-secret',

    'TOKEN_STORE_CLASS': 'momotor.django.token_store.model.ModelTokenStore',
}

HOST

The DNS name or IP address of the Momotor broker.

Default: 'localhost'

PORT

The TCP port the Momotor broker listens on.

Default: 50051 without SSL, 50052 with SSL. See USE_SSL for how the default is picked when you set only one of the two values.

USE_SSL

Whether to use SSL for the broker connection. There are three possible string values:

  • 'yes' requires an SSL connection. The broker certificate is validated.

  • 'insecure' requires an SSL connection, but the certificate is not validated. Use this only when the broker uses a self-signed certificate.

  • 'no' disables SSL. This is not recommended outside local testing.

When you omit both USE_SSL and PORT, the connection uses SSL on port 50052. When you set only PORT, port 50052 means SSL and any other port means no SSL. When you set only USE_SSL, the port defaults to 50051 for 'no' and to 50052 otherwise.

Default: 'yes' on port 50052

API_KEY and API_SECRET

The key and secret used to authenticate to the broker. Both values are required. The broker administrator issues them for your site.

TOKEN_STORE_CLASS

The token store class that saves the broker session token, as a dotted import path. See Token stores for how to pick a store and how to write your own.

Available token store classes are:

Default: 'momotor.django.token_store.model.ModelTokenStore'

INFO_MAX_AGE

How long, in seconds, the broker server information is cached before server_info() asks the broker again.

Default: 30

TOKEN_DATABASE_NAME

Only used when TOKEN_STORE_CLASS is momotor.django.token_store.model.ModelTokenStore.

The name of the database that holds the token model. The name refers to an entry in the DATABASES Django setting.

Default: 'default'

TOKEN_CACHE_NAME

Only used when TOKEN_STORE_CLASS is momotor.django.token_store.cache.CachedTokenStore.

The name of the cache that stores the tokens. The name refers to an entry in the CACHES Django setting.

Default: 'default'

TOKEN_KEY

Only used when TOKEN_STORE_CLASS is momotor.django.token_store.cache.CachedTokenStore.

The cache key for the token. The key is formatted with the MOMOTOR_BROKER dictionary, so any value in the dictionary can make the key unique, as {[API_KEY]} does in the default.

Default: 'momotor-broker-auth-token-{[API_KEY]}'