labb 0.5.0 is out

settings.py

LABB_SETTINGS in Django settings.py: configure labb, django-cotton integration, and optional labbdocs for your django ui project.

labb reads a single LABB_SETTINGS dict from your Django settings. Every key is optional; this page lists them and their defaults.

Overview of LABB_SETTINGS

All labb-specific settings live under a single LABB_SETTINGS dict in your Django settings.py:

settings.py
LABB_SETTINGS = {
    'DEFAULT_THEME': 'labb-light',
}

Only set what you need. Every setting is optional and has a built-in default.

Settings reference

DEFAULT_THEME

Default "__system__"
Type str

The theme applied to new users who have not yet made a selection. Can be any daisyUI theme registered in your project's input.css. The special value "__system__" defers to the OS-level light/dark preference.

LABB_SETTINGS = {
    'DEFAULT_THEME': 'labb-light',
}

CHART_JS_PATH

Default "labb/js/vendor/chart.umd.min.js"
Type str

Path to the Chart.js file used by the chart components. By default labb serves its own bundled copy. Set a full URL to load Chart.js from a CDN instead.

LABB_SETTINGS = {
    'CHART_JS_PATH': 'https://cdn.jsdelivr.net/npm/chart.js@4/dist/chart.umd.min.js',
}

REACTIVITY

Options for how reactive state is stored in the URL when a c-lbr.signals uses syncQuery.

Key Default Description
QUERY_KEY "lbr" The query-string parameter that holds the synced signals.
QUERY_ENCODING "flat" How the signals are written to the URL: "flat" (readable), "json", or "base64" (compact).
LABB_SETTINGS = {
    'REACTIVITY': {
        'QUERY_KEY': 'lbr',
        'QUERY_ENCODING': 'flat',
    },
}

See the Reactivity guide for how reactivity works.


Functions

get_labb_setting()

Retrieves a setting from LABB_SETTINGS with fallback to labb's built-in defaults:

from labb.django_settings import get_labb_setting

theme = get_labb_setting('DEFAULT_THEME')
chart_path = get_labb_setting('CHART_JS_PATH')

Signature: get_labb_setting(key, default=None)

Parameter Description
key Setting name to retrieve
default Fallback if the key is absent from both LABB_SETTINGS and labb's defaults

get_default_theme()

Convenience function to get the current default theme setting.

from labb.django_settings import get_default_theme

theme = get_default_theme()