server.core

Attributes

local_hostnames

Classes

_OptionalDictConfigArgs

dict() -> new empty dictionary

Request

Server

A WSGI application that hosts multiple WSGI applications in the

Module Contents

class server.core._OptionalDictConfigArgs[source]

Bases: TypedDict

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

version: Literal[1][source]
formatters: dict[str, logging.config._FormatterConfiguration][source]
filters: dict[str, logging.config._FilterConfiguration][source]
handlers: dict[str, logging.config._HandlerConfiguration][source]
loggers: dict[str, logging.config._LoggerConfiguration][source]
root: logging.config._RootLoggerConfiguration[source]
incremental: bool[source]
disable_existing_loggers: bool[source]
server.core.local_hostnames[source]
class server.core.Request(environ, charset=None, unicode_errors=None, decode_param_names=None, **kw)[source]

Bases: webob.request.BaseRequest

hostname_keys = ('HTTP_HOST', 'HTTP_X_VHM_HOST')[source]
property hostnames: Iterator[str][source]

Iterates through the hostnames of the request.

class server.core.Server(config: server.config.Config, configure_morepath: bool = True, configure_logging: bool = True, post_mortem: bool = False, environ_overrides: dict[str, Any] | None = None, exception_hook: Callable[[WSGIEnvironment], Any] | None = None)[source]

A WSGI application that hosts multiple WSGI applications in the same process.

Not to be confused with Morepath’s mounting functionality. The morepath applications hosted by this WSGI application are root applications, not mounted applications.

See Morepath’s way of nesting applications

Applications are hosted in two ways:

  1. As static applications under a base path (/app)

  2. As wildcard applications under a base path with wildcard (/sites/*)

There is no further nesting and there is no way to run an application under /.

The idea for this server is to run a number of WSGI applications that are relatively independent, but share a common framework. Though thought to be used with Morepath this module does not try to assume anything but a WSGI application.

Since most of the time we will be running morepath applications, this server automatically configures morepath for the applications that depend on it.

If morepath autoconfig is not desired, set configure_morepath to False.

applications[source]
wildcard_applications[source]
post_mortem[source]
environ_overrides[source]
exception_hook[source]
configure_logging(config: _OptionalDictConfigArgs | _DictConfigArgs) None[source]

Configures the python logging.

Config:

A dictionary that is understood by python’s logging.config.dictConfig method.

configure_morepath() None[source]

Configures morepath automatically, if any application uses it.

handle_request(environ: _typeshed.wsgi.WSGIEnvironment, start_response: _typeshed.wsgi.StartResponse) Iterable[bytes][source]
__call__(environ: _typeshed.wsgi.WSGIEnvironment, start_response: _typeshed.wsgi.StartResponse) Iterable[bytes][source]