Celery settings object.
Attributes
| Attribute | Type | Description |
|---|
| deprecated_settings | iterable = null | A collection of legacy configuration keys used to trigger deprecation warnings during application initialization. |
| broker_read_url | string | The connection URL used for consuming messages from the broker, prioritized from environment variables or specific read-only configurations. |
| broker_write_url | string | The connection URL used for sending messages to the broker, falling back to the default broker URL if no write-specific override is provided. |
| broker_url | string | The primary connection string for the message broker, resolved from the CELERY_BROKER_URL environment variable or legacy host settings. |
| result_backend | string | The connection URI for the result store backend used to persist task states and return values. |
| task_default_exchange | string | The name of the default message exchange to use when no specific exchange is defined for a task. |
| task_default_routing_key | string | The default routing key used to bind queues and route messages when a specific key is not provided. |
| timezone | string | The configured time zone for task scheduling and datetime operations, supporting both Celery and Django-style configuration keys. |
Constructor
Signature
def Settings(
*args: any,
deprecated_settings: iterable = None,
**kwargs: any
)
Parameters
| Name | Type | Description |
|---|
| *args | any | Variable length argument list passed to the parent class constructor. |
| deprecated_settings | iterable = None | An optional collection of settings that are marked as deprecated. |
| **kwargs | any | Arbitrary keyword arguments passed to the parent class constructor. |
Signature
def Settings(
*args: any,
deprecated_settings: list = None,
**kwargs: any
) - > null
Parameters
| Name | Type | Description |
|---|
| *args | any | Positional arguments passed to the parent ConfigurationView class |
| deprecated_settings | list = None | A list of setting keys that have been deprecated and should trigger warnings |
| **kwargs | any | Keyword arguments passed to the parent ConfigurationView class |
Methods
broker_read_url()
@classmethod
def broker_read_url() - > string
Retrieves the URL used for reading from the message broker, falling back to the default broker URL if not explicitly set.
Returns
| Type | Description |
|---|
string | The connection string for the read-only broker connection |
broker_write_url()
@classmethod
def broker_write_url() - > string
Retrieves the URL used for writing to the message broker, falling back to the default broker URL if not explicitly set.
Returns
| Type | Description |
|---|
string | The connection string for the write-only broker connection |
broker_url()
@classmethod
def broker_url() - > string
Retrieves the primary broker connection URL from environment variables or configuration keys.
Returns
| Type | Description |
|---|
string | The primary broker connection string |
result_backend()
@classmethod
def result_backend() - > string
Retrieves the configured result backend URL used for storing task results.
Returns
| Type | Description |
|---|
string | The connection string for the result storage backend |
task_default_exchange()
@classmethod
def task_default_exchange() - > string
Retrieves the default exchange name for tasks, falling back to the default queue name if not specified.
Returns
| Type | Description |
|---|
string | The name of the default AMQP exchange |
task_default_routing_key()
@classmethod
def task_default_routing_key() - > string
Retrieves the default routing key for tasks, falling back to the default queue name if not specified.
Returns
| Type | Description |
|---|
string | The default routing key string |
timezone()
@classmethod
def timezone() - > string
Retrieves the configured timezone, supporting both Celery and Django timezone setting keys.
Returns
| Type | Description |
|---|
string | The timezone identifier string |
without_defaults()
@classmethod
def without_defaults() - > [Settings](settings.md?sid=celery_app_utils_settings)
Return the current configuration, but without defaults.
Returns
| Type | Description |
|---|
[Settings](settings.md?sid=celery_app_utils_settings) | A new Settings object containing only user-defined configuration values |
value_set_for()
@classmethod
def value_set_for(
key: string
) - > boolean
Checks if a specific configuration key has been explicitly set by the user rather than relying on a default.
Parameters
| Name | Type | Description |
|---|
| key | string | The configuration key to check for explicit definition |
Returns
| Type | Description |
|---|
boolean | True if the key is present in the user-defined configuration, False otherwise |
find_option()
@classmethod
def find_option(
name: string,
namespace: string = ''
) - > tuple
Search for option by name.
Parameters
| Name | Type | Description |
|---|
| name | string | Full name of the option to search for |
| namespace | string = '' | The preferred namespace to search within |
Returns
| Type | Description |
|---|
tuple | A tuple of (namespace, key, type) for the found option |
find_value_for_key()
@classmethod
def find_value_for_key(
name: string,
namespace: string = 'celery'
) - > any
Shortcut to get_by_parts(*find_option(name)[:-1]).
Parameters
| Name | Type | Description |
|---|
| name | string | The name of the setting to find |
| namespace | string = 'celery' | The namespace to use for the search |
Returns
| Type | Description |
|---|
any | The value associated with the resolved configuration key |
get_by_parts()
@classmethod
def get_by_parts(
*parts: string
) - > any
Return the current value for setting specified as a path.
Parameters
| Name | Type | Description |
|---|
| *parts | string | Individual components of a setting name to be joined (e.g., 'worker', 'concurrency') |
Returns
| Type | Description |
|---|
any | The value of the setting found by joining the provided parts with underscores |
finalize()
@classmethod
def finalize() - > [Settings](settings.md?sid=celery_app_utils_settings)
Triggers the reading of the actual configuration by performing a dummy access, ensuring the view is fully populated.
Returns
| Type | Description |
|---|
[Settings](settings.md?sid=celery_app_utils_settings) | The finalized Settings instance |
table()
@classmethod
def table(
with_defaults: boolean = False,
censored: boolean = True
) - > dict
Generates a dictionary of configuration settings, optionally including defaults and filtering sensitive information.
Parameters
| Name | Type | Description |
|---|
| with_defaults | boolean = False | Whether to include default Celery settings in the output |
| censored | boolean = True | Whether to mask sensitive information like passwords and API keys |
Returns
| Type | Description |
|---|
dict | A dictionary mapping setting names to their current values |
humanize()
@classmethod
def humanize(
with_defaults: boolean = False,
censored: boolean = True
) - > string
Return a human readable text showing configuration changes.
Parameters
| Name | Type | Description |
|---|
| with_defaults | boolean = False | Whether to include default settings in the human-readable output |
| censored | boolean = True | Whether to mask sensitive values in the output |
Returns
| Type | Description |
|---|
string | A formatted string containing key-value pairs of the configuration |
maybe_warn_deprecated_settings()
@classmethod
def maybe_warn_deprecated_settings() - > boolean
Issues deprecation warnings for any settings identified as deprecated during initialization.
Returns
| Type | Description |
|---|
boolean | True if warnings were issued, False if no deprecated settings were found |