MCPcopy Index your code
hub / github.com/fluentpython/example-code-2e / load_app

Function load_app

21-async/mojifinder/bottle.py:3045–3056  ·  view source on GitHub ↗

Load a bottle application from a module and make sure that the import does not affect the current default application, but returns a separate application object. See :func:`load` for the target parameter.

(target)

Source from the content-addressed store, hash-verified

3043
3044
3045def load_app(target):
3046 """ Load a bottle application from a module and make sure that the import
3047 does not affect the current default application, but returns a separate
3048 application object. See :func:`load` for the target parameter. """
3049 global NORUN; NORUN, nr_old = True, NORUN
3050 try:
3051 tmp = default_app.push() # Create a new "default application"
3052 rv = load(target) # Import the target module
3053 return rv if callable(rv) else tmp
3054 finally:
3055 default_app.remove(tmp) # Remove the temporary added default application
3056 NORUN = nr_old
3057
3058_debug = debug
3059def run(app=None, server='wsgiref', host='127.0.0.1', port=8080,

Callers 1

runFunction · 0.85

Calls 2

pushMethod · 0.80
loadFunction · 0.70

Tested by

no test coverage detected