from urlparse import urlparse
es = urlparse(os.environ.get('BONSAI_URL'))
port = es.port or 80
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': es.scheme + '://' + es.hostname + ':' + str(port),
'INDEX_NAME': 'your_index_name',
},
}
if es.username:
HAYSTACK_CONNECTIONS['default']['KWARGS'] = {"http_auth": es.username + ':' + es.password}
Showing posts with label Django-Haystack. Show all posts
Showing posts with label Django-Haystack. Show all posts
Wednesday, December 10, 2014
Correct connection settings for ElasticSearch / Django-Haystack on Bonsai.io
I should have read the documentation about this better, so I'm blogging this because I'm sure other people have had the same issue. Bonsai.io requires the username and password to be sent as an http_auth header.
Subscribe to:
Posts (Atom)