quart.cli module

class quart.cli.AppGroup(name=None, commands=None, **attrs)

Bases: click.core.Group

group(*args: Any, **kwargs: Any) → Any

A shortcut decorator for declaring and attaching a group to the group. This takes the same arguments as group() but immediately registers the created command with this instance by calling into add_command().

exception quart.cli.NoAppException

Bases: click.exceptions.UsageError

class quart.cli.QuartGroup(add_default_commands: bool = True, create_app: Optional[Callable] = None, add_version_option: bool = True, *, params: Optional[List] = None, **kwargs: Any)

Bases: quart.cli.AppGroup

get_command(ctx: click.core.Context, name: str) → click.core.Command

Return the relevant command given the context and name.

Warning

This differs substaintially from Flask in that it allows for the inbuilt commands to be overridden.

list_commands(ctx: click.core.Context) → Iterable[str]

Returns a list of subcommand names in the order they should appear.

main(*args: Any, **kwargs: Any) → Any

This is the way to invoke a script with all the bells and whistles as a command line application. This will always terminate the application after a call. If this is not wanted, SystemExit needs to be caught.

This method is also available by directly calling the instance of a Command.

New in version 3.0: Added the standalone_mode flag to control the standalone mode.

Parameters
  • args – the arguments that should be used for parsing. If not provided, sys.argv[1:] is used.

  • prog_name – the program name that should be used. By default the program name is constructed by taking the file name from sys.argv[0].

  • complete_var – the environment variable that controls the bash completion support. The default is "_<prog_name>_COMPLETE" with prog_name in uppercase.

  • standalone_mode – the default behavior is to invoke the script in standalone mode. Click will then handle exceptions and convert them into error messages and the function will never return but shut down the interpreter. If this is set to False they will be propagated to the caller and the return value of this function is the return value of invoke().

  • extra – extra keyword arguments are forwarded to the context constructor. See Context for more information.

class quart.cli.ScriptInfo(app_import_path: Optional[str] = None, create_app: Optional[Callable] = None)

Bases: object

load_app() → Quart
load_dotenv_if_exists() → None
quart.cli.get_version(ctx: Any, param: Any, value: Any) → None
quart.cli.main(as_module: bool = False) → None