def http_api_setup(app, config, log_ui_class=LogUI, test_ui_class=TestsStandaloneUI):
    workspace = config['app'].get('workspace') or 'work'
    if os.path.exists(workspace):
        workspace = os.path.realpath(workspace)
    else:
        raise Exception('workspace (define in app -> workspace) [%s] not exists.' % os.path.realpath(workspace))

    # setting logging
    if config.get('logging'):
        set_logging(config['logging'], workspace)
        # log.debug('app config: %s', json.dumps(config['app'], indent=4))

    if config.get('databases'):
        setup_database(config['databases'])

    # configure flask app
    setup_app(app, config)

    # parameter types
    parameter_types(app, config['app']['parameter_types'])

    # configure view
    setup_view(app, config['app'].get('view_packages', ()))

    # configure web ui
    setup_web_ui(app, config['app']['web_ui'], workspace, log_ui_class, test_ui_class)

    return workspace
dataset/ETHPy150Open remyzane/flask-http-api/http_api/configure.py/http_api_setup/original