Pyjoyment.Command.wsgi - WSGI command

Usage: APPLICATION wsgi [OPTIONS]

  application = app.start('wsgi')
  PYJO_WSGI=1 gunicorn 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", "plain" without
                            time and process, 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.wsgi starts applications with the Pyjo.Server.WSGI backend: it returns the WSGI application, which a script keeps for the WSGI server that imports it. The script of an application that ends with application = app.start() runs this command when the PYJO_WSGI 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.

Ported from Mojolicious::Command::psgi of Mojolicious 9.49, for WSGI instead of PSGI.

Classes

class Pyjoyment.Command.wsgi.Pyjoyment_Command_wsgi(**kwargs: Any)[source]

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

description = 'Start application with WSGI'
description = wsgi.description
wsgi.description = 'Foo'

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

run(*args: str) → Any[source]
application = wsgi.run()

Run this command.

usage = 'Usage: APPLICATION wsgi [OPTIONS]\n\n  application = app.start(\'wsgi\')\n  PYJO_WSGI=1 gunicorn 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", "plain" without\n                            time and process, or "json", defaults to the\n                            value of PYJO_LOG_FORMAT or "text"\n  -m, --mode <name>         Operating mode for your application, defaults to\n                            the value of PYJO_MODE or "development"\n'
usage = wsgi.usage
wsgi.usage = 'Foo'

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