aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/utility')
-rw-r--r--wqflask/utility/elasticsearch_tools.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/wqflask/utility/elasticsearch_tools.py b/wqflask/utility/elasticsearch_tools.py
index c2c999ea..8b8ad9cc 100644
--- a/wqflask/utility/elasticsearch_tools.py
+++ b/wqflask/utility/elasticsearch_tools.py
@@ -1,10 +1,14 @@
-from elasticsearch import Elasticsearch, TransportError
-from utility.tools import ELASTICSEARCH_HOST, ELASTICSEARCH_PORT
+es = None
+try:
+ from elasticsearch import Elasticsearch, TransportError
+ from utility.tools import ELASTICSEARCH_HOST, ELASTICSEARCH_PORT
-es = Elasticsearch([{
- "host": ELASTICSEARCH_HOST
- , "port": ELASTICSEARCH_PORT
-}])
+ es = Elasticsearch([{
+ "host": ELASTICSEARCH_HOST
+ , "port": ELASTICSEARCH_PORT
+ }]) if (ELASTICSEARCH_HOST and ELASTICSEARCH_PORT) else None
+except:
+ es = None
def get_user_by_unique_column(column_name, column_value):
user_details = None