Pyjoyment.Command.asgi - ASGI command

Usage: APPLICATION asgi [OPTIONS]

  application = app.start('asgi')
  PYJO_ASGI=1 uvicorn myapp:application

Options:
  -h, --help                Show this summary of available options
      --home <path>         Path to home directory of your application,
                            defaults to the value of PYJO_HOME or
                            auto-detection
      --log-format <name>   Format of log messages, "text" or "json",
                            defaults to the value of PYJO_LOG_FORMAT or
                            "text"
  -m, --mode <name>         Operating mode for your application, defaults to
                            the value of PYJO_MODE or "development"

Pyjoyment.Command.asgi starts applications with the Pyjo.Server.ASGI backend: it returns the ASGI application, which a script keeps for the ASGI server that imports it. The script of an application that ends with application = app.start() runs this command when the PYJO_ASGI environment variable is set, and the command of its arguments otherwise.

This is a core command, that means it is always enabled and its code a good example for learning to build new commands, you’re welcome to fork it.

See Pyjoyment.Commands for a list of commands that are available by default.

See also

Pyjoyment, https://mojolicious.org.

Inspired by Mojolicious::Command::psgi of Mojolicious 9.49, for ASGI.

Classes

class Pyjoyment.Command.asgi.Pyjoyment_Command_asgi(**kwargs: Any)

Pyjoyment.Command.asgi inherits all attributes and methods from Pyjoyment.Command and implements the following new ones.

description = 'Start application with ASGI'
description = asgi.description
asgi.description = 'Foo'

Short description of this command, used for the command list.

run(*args: str) → Any
application = asgi.run()

Run this command.

usage = 'Usage: APPLICATION asgi [OPTIONS]\n\n  application = app.start(\'asgi\')\n  PYJO_ASGI=1 uvicorn myapp:application\n\nOptions:\n  -h, --help                Show this summary of available options\n      --home <path>         Path to home directory of your application,\n                            defaults to the value of PYJO_HOME or\n                            auto-detection\n      --log-format <name>   Format of log messages, "text" or "json",\n                            defaults to the value of PYJO_LOG_FORMAT or\n                            "text"\n  -m, --mode <name>         Operating mode for your application, defaults to\n                            the value of PYJO_MODE or "development"\n'
usage = asgi.usage
asgi.usage = 'Foo'

Usage information for this command, used for the help screen.