Load a WSGI application from the PasteDeploy config file specified
by config_uri. The environment will be configured as if it is
currently serving request, leaving a natural environment in place
to write scripts that can generate URLs and utilize renderers.

This function returns a dictionary with app, root, closer,
request, and registry keys. app is the WSGI app loaded
(based on the config_uri), root is the traversal root resource
of the Pyramid application, and closer is a parameterless callback
that may be called when your script is complete (it pops a threadlocal
stack).

Note

Most operations within Pyramid expect to be invoked
within the context of a WSGI request, thus it’s important when
loading your application to anchor it when executing scripts
and other code that is not normally invoked during active WSGI
requests.

config_uri – specifies the PasteDeploy config file to use for the
interactive shell. The format is inifile#name. If the name is left
off, main will be assumed.

request – specified to anchor the script to a given set of WSGI
parameters. For example, most people would want to specify the host,
scheme and port such that their script will generate URLs in relation
to those parameters. A request with default parameters is constructed
for you if none is provided. You can mutate the request’s environ
later to setup a specific host/port/scheme/etc.