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)
| 3043 | |
| 3044 | |
| 3045 | def 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 |
| 3059 | def run(app=None, server='wsgiref', host='127.0.0.1', port=8080, |