diff --git a/application/libs/flask_elasticsearch/elasticsearch.py b/application/libs/flask_elasticsearch/elasticsearch.py index b2128dd759c2b68a54b09635d8a10258d569d5d2..600ac33925d1a17945f3f1d3eaeb05efe3fe3109 100644 --- a/application/libs/flask_elasticsearch/elasticsearch.py +++ b/application/libs/flask_elasticsearch/elasticsearch.py @@ -15,21 +15,13 @@ from typing import Any from elasticsearch import Elasticsearch from flask import Flask +from flask import _app_ctx_stack as stack_context from flask_elasticsearch import FlaskElasticsearch as BaseFlaskElasticsearch from loguru import logger from application.common import ConfigHelper -# Find the stack on which we want to store the database connection. -# Starting with Flask 0.9, the _app_ctx_stack is the correct one, -# before that we need to use the _request_ctx_stack. -try: - from flask import _app_ctx_stack as stack_context -except ImportError: - from flask import _request_ctx_stack as stack_context - - class FlaskElasticsearch(BaseFlaskElasticsearch): def __init__(self, app=None, **kwargs): """