Plain is headed towards 1.0! Subscribe for development updates →

Preflight

System checks for Plain applications.

Preflight checks help identify issues with your settings or environment before running your application.

plain preflight

Development

If you use plain.dev for local development, the Plain preflight command is run automatically when you run plain dev.

Deployment

The plain preflight command should often be part of your deployment process. Make sure to add the --deploy flag to the command to run checks that are only relevant in a production environment.

plain preflight --deploy

Custom preflight checks

Use the @register_check decorator to add your own preflight check to the system. Just make sure that particular Python module is somehow imported so the check registration runs.

from plain.preflight import register_check, Error


@register_check
def custom_check(package_configs, **kwargs):
    return Error("This is a custom error message.", id="custom.C001")

For deployment-specific checks, add the deploy argument to the decorator.

@register_check(deploy=True)
def custom_deploy_check(package_configs, **kwargs):
    return Error("This is a custom error message for deployment.", id="custom.D001")

Silencing preflight checks

The settings.PREFLIGHT_SILENCED_CHECKS setting can be used to silence individual checks by their ID (ex. security.W020).

# app/settings.py
PREFLIGHT_SILENCED_CHECKS = [
    "security.W020",
]
 1from .messages import (
 2    CRITICAL,
 3    DEBUG,
 4    ERROR,
 5    INFO,
 6    WARNING,
 7    CheckMessage,
 8    Critical,
 9    Debug,
10    Error,
11    Info,
12    Warning,
13)
14from .registry import register_check, run_checks
15
16# Import these to force registration of checks
17import plain.preflight.files  # NOQA isort:skip
18import plain.preflight.security  # NOQA isort:skip
19import plain.preflight.urls  # NOQA isort:skip
20
21
22__all__ = [
23    "CheckMessage",
24    "Debug",
25    "Info",
26    "Warning",
27    "Error",
28    "Critical",
29    "DEBUG",
30    "INFO",
31    "WARNING",
32    "ERROR",
33    "CRITICAL",
34    "register_check",
35    "run_checks",
36]