diff --git a/app/deploy/hosts.py b/app/deploy/hosts.py index fec0139..f6dfea3 100644 --- a/app/deploy/hosts.py +++ b/app/deploy/hosts.py @@ -9,7 +9,7 @@ class WebHost(SSHHost): slug = 'web' address = '151.248.125.130' username = 'web' - password = '9oijffDf2vi@D!' + password = '0cg@XA$b$h8LKQf' class DatabaseHost(WebHost): slug = 'database' diff --git a/trademark/views.py b/trademark/views.py index 0c9f88a..f7c2149 100644 --- a/trademark/views.py +++ b/trademark/views.py @@ -93,7 +93,9 @@ class SearchResultsThread(threading.Thread): super(SearchResultsThread, self).__init__(**kwargs) def run(self): - self.keyword.load_results() + loaded = false + while not loaded: + loaded = self.keyword.load_results() class Search(generic.View): @@ -104,10 +106,6 @@ class Search(generic.View): def get(self, request, slug): keyword = get_object_or_404(Keyword, slug=slug) - loading = SearchResultsThread(keyword=keyword) - loading.start() - - identity = keyword.searches.filter(similarity=146)[0] contains = keyword.searches.filter(similarity=100)[0] @@ -145,6 +143,9 @@ class Search(generic.View): else: return HttpResponse(json.dumps({ 'status': 'error', 'description': 'Empty request'}), content_type="application/json") + loading = SearchResultsThread(keyword=keyword) + loading.start() + identity = k.searches.filter(similarity=146)[0] contains = k.searches.filter(similarity=100)[0] @@ -172,6 +173,8 @@ class Search(generic.View): 'status': 'ok' } + + return HttpResponse(json.dumps(response), content_type="application/json")