Settings

django-typer reads a small number of settings from your Django settings module. Two of them can also be given as environment variables of the same name, which is convenient for deployments where the settings module is shared but a particular invocation needs a different value. The settings module always wins over the environment.

DT_MANAGE_SCRIPT

  • Default: not set

  • Environment variable: DT_MANAGE_SCRIPT

The program name to show in the Usage: line of command help and to install shell completions for. When not set the name is detected from the script that was invoked, which is right for manage.py and for scripts installed on the path. Set it when the detected name is not the one users type, for example when the script runs through a wrapper such as a just recipe or poetry run:

settings.py
DT_MANAGE_SCRIPT = "mycli"

The value is used verbatim. See Configure the Manage Script Name and Completions for Wrapped Invocations.

DT_PRINT_RESULT

  • Default: False

  • Environment variable: DT_PRINT_RESULT (1, true, yes or on to enable, case insensitive)

Whether a truthy value returned from a command is written to stdout, as BaseCommand does. django-typer leaves this off: return values are for callers and output is whatever the command prints. Set it to True to restore the Django behavior project wide. A command’s own print_result class field, when set, takes precedence over this setting.

settings.py
DT_PRINT_RESULT = True

See Toggle on/off result printing and Exit Codes, Errors and Aborts.

DT_RICH_TRACEBACK_CONFIG

Default: {"show_locals": False}

Configures the rich traceback hook django-typer installs when rich is available. The value is a dictionary of keyword arguments for rich.traceback.install(), for example show_locals, width or suppress, plus one django-typer specific key:

  • no_install - when True the hook is not installed, but the rest of the configuration still applies to Typer’s own exception rendering. Use this if your project installs rich tracebacks itself.

True selects the defaults. False or None switches rich tracebacks off entirely, and tracebacks are rendered the way Django renders them.

settings.py
DT_RICH_TRACEBACK_CONFIG = {"show_locals": True, "width": 120}

The --show-locals and --hide-locals command line options override show_locals for a single invocation. See Configure rich Stack Traces.