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
评论列表
文章目录