def load_app(app_path, wsgi_app_full_name):

    if app_path:
        absolute_path = os.path.abspath(os.path.expanduser(app_path))
        log.debug("Adding %s to sys.path" % absolute_path)
        sys.path.append(absolute_path)

    if wsgi_app_full_name:
        log.info("Loading WSGI application object: %s" % wsgi_app_full_name)
        return import_object(wsgi_app_full_name)

    app_loaders = IAppLoader.implementors()
    log.debug("Found {0} loaders: {1}".format(len(app_loaders), app_loaders))
    for loader in app_loaders:
        if loader.can_load(app_path):
            log.info("Using AppLoader: %s" % loader.__class__.__name__)
            return loader.load_app(absolute_path, wsgi_app_full_name)

    raise Exception("No Loader found for app %s and no --wsgi-app option found\n" % app_path)
dataset/ETHPy150Open daltonmatos/wsgid/wsgid/loaders/__init__.py/load_app/original