Command-line interface

July 25, 2026 ยท View on GitHub

Installing django-language-server adds the djls executable. It can check templates in a terminal or start the language server.

djls check

Check Django templates without an editor:

$ djls check [OPTIONS] [PATH]...

Run the command from the Django project root so it can load djls.toml, .djls.toml, or pyproject.toml and discover the project environment.

Input

InputBehavior
No pathCheck templates in the directories discovered from Django settings
File pathsCheck the named template files
Directory pathsRecursively check supported template files below those directories
-Read one template from standard input; cannot be combined with paths

File and directory scans recognize .html, .htm, and .djhtml files.

# Check all discovered template directories
djls check

# Check explicit files or directories
djls check templates/ app/templates/page.html

# Check standard input
printf '{{ value|default }}' | djls check -

Options

OptionMeaning
--select CODE,...Enable the named diagnostic codes, overriding project configuration
--ignore CODE,...Disable the named diagnostic codes
-g, --glob PATTERNInclude or exclude matching files; prefix exclusions with !; later patterns win
-., --hiddenInclude hidden files and directories
--no-ignoreDo not read .gitignore, .ignore, and related ignore files
-L, --followFollow symbolic links
-d, --max-depth DEPTHLimit directory traversal depth
--color always|auto|neverControl colored diagnostic output
-q, --quietSuppress output and report the result through the exit status

djls check exits with status 0 when no enabled diagnostics are found and status 1 when diagnostics or a command error occur. Run djls check --help for the command's full help text.

The pre-commit hook runs this command on staged templates.

djls serve

Start the Language Server Protocol server over standard input and output:

$ djls serve

Editors normally start this command through their LSP client configuration. TCP transport is not supported.

Formatting

Django template formatting is an editor feature. Enable it in format configuration, then use the editor's format-document command. There is no djls format command.