server.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:kripodb 作者: 3D-e-Chem 项目源码 文件源码
def wsgi_app(similarities, fragments, pharmacophores, external_url='http://localhost:8084/kripo'):
    """Create wsgi app

    Args:
        similarities (SimilarityMatrix): Similarity matrix to use in webservice
        fragments (FragmentsDb): Fragment database filename
        pharmacophores: Filename of pharmacophores hdf5 file
        external_url (str): URL which should be used in Swagger spec

    Returns:
        connexion.App
    """
    app = connexion.App(__name__)
    url = urlparse(external_url)
    swagger_file = resource_filename(__name__, 'swagger.yaml')
    app.app.json_encoder = KripodbJSONEncoder
    app.app.config['similarities'] = similarities
    app.app.config['fragments'] = fragments
    app.app.config['pharmacophores'] = pharmacophores
    arguments = {'hostport': url.netloc, 'scheme': url.scheme, 'version': __version__}
    # Keep validate_responses turned off, because of conflict with connexion.problem
    # see https://github.com/zalando/connexion/issues/266
    app.add_api(swagger_file, base_path=url.path, arguments=arguments)
    return app
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号