liveBook · Manning

System check

As explained in Django in Action

A Django system check is an automated inspection of project configuration and application setup for problems.

A Django system check is an automated inspection of project configuration and application setup. Django runs these checks when the development server starts, helping catch problems before the application handles requests. section 14.1

System checks fit into Django’s management-command workflow:

  • Run the same inspection explicitly with python manage.py check. section 9.3.1
  • Expect checks to run automatically before custom management commands unless they are skipped. section 9.3.1
  • Pass --skip-checks when a command should bypass checking, or set requires_system_checks to an empty tuple in the command class. section 9.3.1
  • Register custom checks to validate project code or perform other application-specific inspections. section 14.1
(venv) RiffMates$ python manage.py musicians --help
usage: manage.py musicians [-h] [--last_name LAST_NAME]
                           [--first_name FIRST_NAME] [--birth BIRTH]
                           [--version] [-v {0,1,2,3}]
                           [--settings SETTINGS] [--pythonpath PYTHONPATH]
                           [--traceback] [--no-color] [--force-color]
                           [--skip-checks]

Lists registered musicians  #1

options:
  -h, --help            show this help message and exit  #2
  --last_name LAST_NAME, -l LAST_NAME  #3
                        Query musicians whose last name is greater than or
                        equal to this value. Note this is case-sensitive.
  --first_name FIRST_NAME, -f FIRST_NAME
                        Query musicians whose first name is greater than
                        or equal to this value. Note this is case-sensitive.
  --birth BIRTH, -b BIRTH
                        Query musicians whose birth date is greater than
                        or equal to this value. Date must be given in
                        YYYY-MM-DD format.
  --version             Show program's version number and exit.
  -v {0,1,2,3}, --verbosity {0,1,2,3}
                        Verbosity level; 0=minimal output, 1=normal
                        output, 2=verbose output, 3=very verbose output
  --settings SETTINGS   The Python path to a settings module, e.g.
                        "myproject.settings.main". If this isn't provided,
                        the DJANGO_SETTINGS_MODULE environment variable
                        will be used.
  --pythonpath PYTHONPATH
                        A directory to add to the Python path, e.g.
                        "/home/djangoprojects/myproject".
  --traceback           Raise on CommandError exceptions.
  --no-color            Don't colorize the command output.
  --force-color         Force colorization of the command output.
  --skip-checks         Skip system checks.

The musicians command help listing shows system-check controls alongside ordinary command options, including --skip-checks. section 9.3.1

How Django in Action covers it

How deep it goes
Explains invocation, skipping, and custom registration but does not detail individual checks or their implementation APIs.
Examples
Uses python manage.py check, a musicians command help listing, --skip-checks, and custom registered checks.
What you can do after
Operate/configure Django checks through the check command, command-line flags, or requires_system_checks.
How it connects
Connects system checks with the development server, management commands, project configuration, and code validation.

This explainer was generated by Manning's knowledge graph from the text of Django in Action. The section links point to the parts of the book it draws on.