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}
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:
Post Comments (Atom)
Thank's for this blog post! I am evaluating Bonsai.io and this saved my quite some time!
ReplyDeleteGlad to be of help -- I posted this less than 24 hours ago!
ReplyDeleteHehe! Just in time blogging :)
ReplyDelete