- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用Heroku上的elasticsearch为我的Django应用程序实现Haystack搜索。
我按照此处的说明进行操作:https://devcenter.heroku.com/articles/searchbox#using-haystack-with-django设置Searchbox插件。
settings.py:
from urlparse import urlparse
es = urlparse(os.environ.get('SEARCHBOX_URL'))
port = es.port
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': es.scheme + '://' + es.hostname + ':' + str(port),
'INDEX_NAME': 'haystack',
},
}
if es.username:
HAYSTACK_CONNECTIONS['default']['KWARGS'] = {"http_auth": es.username + ':' + es.password}
heroku run python manage.py rebuild_index
Removing all documents from your index because you said so.
No handlers could be found for logger "elasticsearch"
Failed to clear Elasticsearch index: ConnectionError(('Connection aborted.', gai
error(-2, 'Name or service not known'))) caused by: ProtocolError(('Connection a
borted.', gaierror(-2, 'Name or service not known')))
All documents removed.
Indexing 133 links
ERROR:root:Error updating links using default
Traceback (most recent call last):
File "/app/.heroku/python/lib/python2.7/site-packages/haystack/management/comm
ands/update_index.py", line 189, in handle_label
self.update_backend(label, using)
File "/app/.heroku/python/lib/python2.7/site-packages/haystack/management/comm
ands/update_index.py", line 234, in update_backend
do_update(backend, index, qs, start, end, total, self.verbosity)
File "/app/.heroku/python/lib/python2.7/site-packages/haystack/management/comm
ands/update_index.py", line 89, in do_update
backend.update(index, current_qs)
File "/app/.heroku/python/lib/python2.7/site-packages/haystack/backends/elasti
csearch_backend.py", line 187, in update
bulk_index(self.conn, prepped_docs, index=self.index_name, doc_type='modelre
sult')
File "/app/.heroku/python/lib/python2.7/site-packages/elasticsearch/helpers/__
init__.py", line 145, in bulk
for ok, item in streaming_bulk(client, actions, **kwargs):
File "/app/.heroku/python/lib/python2.7/site-packages/elasticsearch/helpers/__
init__.py", line 104, in streaming_bulk
resp = client.bulk(bulk_actions, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/elasticsearch/client/uti
ls.py", line 68, in _wrapped
return func(*args, params=params, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/elasticsearch/client/__i
nit__.py", line 646, in bulk
params=params, body=self._bulk_body(body))
File "/app/.heroku/python/lib/python2.7/site-packages/elasticsearch/transport.
py", line 284, in perform_request
status, headers, data = connection.perform_request(method, url, params, body
, ignore=ignore, timeout=timeout)
File "/app/.heroku/python/lib/python2.7/site-packages/elasticsearch/connection
/http_urllib3.py", line 51, in perform_request
raise ConnectionError('N/A', str(e), e)
ConnectionError: ConnectionError(('Connection aborted.', gaierror(-2, 'Name or s
ervice not known'))) caused by: ProtocolError(('Connection aborted.', gaierror(-
2, 'Name or service not known')))
Traceback (most recent call last):
File "maldio_project/manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/_
_init__.py", line 399, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/_
_init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/b
ase.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/b
ase.py", line 285, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python2.7/site-packages/haystack/management/comm
ands/rebuild_index.py", line 16, in handle
call_command('update_index', **options)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/_
_init__.py", line 159, in call_command
return klass.execute(*args, **defaults)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/b
ase.py", line 285, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python2.7/site-packages/haystack/management/comm
ands/update_index.py", line 184, in handle
return super(Command, self).handle(*items, **options)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/b
ase.py", line 385, in handle
label_output = self.handle_label(label, **options)
File "/app/.heroku/python/lib/python2.7/site-packages/haystack/management/comm
ands/update_index.py", line 189, in handle_label
self.update_backend(label, using)
File "/app/.heroku/python/lib/python2.7/site-packages/haystack/management/comm
ands/update_index.py", line 234, in update_backend
do_update(backend, index, qs, start, end, total, self.verbosity)
File "/app/.heroku/python/lib/python2.7/site-packages/haystack/management/comm
ands/update_index.py", line 89, in do_update
backend.update(index, current_qs)
File "/app/.heroku/python/lib/python2.7/site-packages/haystack/backends/elasti
csearch_backend.py", line 187, in update
bulk_index(self.conn, prepped_docs, index=self.index_name, doc_type='modelre
sult')
File "/app/.heroku/python/lib/python2.7/site-packages/elasticsearch/helpers/__
init__.py", line 145, in bulk
for ok, item in streaming_bulk(client, actions, **kwargs):
File "/app/.heroku/python/lib/python2.7/site-packages/elasticsearch/helpers/__
init__.py", line 104, in streaming_bulk
resp = client.bulk(bulk_actions, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/elasticsearch/client/uti
ls.py", line 68, in _wrapped
return func(*args, params=params, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/elasticsearch/client/__i
nit__.py", line 646, in bulk
params=params, body=self._bulk_body(body))
File "/app/.heroku/python/lib/python2.7/site-packages/elasticsearch/transport.
py", line 284, in perform_request
status, headers, data = connection.perform_request(method, url, params, body
, ignore=ignore, timeout=timeout)
File "/app/.heroku/python/lib/python2.7/site-packages/elasticsearch/connection
/http_urllib3.py", line 51, in perform_request
raise ConnectionError('N/A', str(e), e)
elasticsearch.exceptions.ConnectionError: ConnectionError(('Connection aborted.'
, gaierror(-2, 'Name or service not known'))) caused by: ProtocolError(('Connect
ion aborted.', gaierror(-2, 'Name or service not known')))
最佳答案
掉了很多头发(:P)之后,我发现了问题所在!
这是问题所在:
port = es.port
port = es.port or 80
关于django - Django Haystack:Heroku Searchbox插件无法运行rebuild_index,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26441557/
我正在尝试在我的本地开发环境(运行 Ubuntu 12.04 的 vagrant VM)上设置 ElasticSearch/Haystack,但我无法完成重新索引过程。 ES 正在运行,我已经创建了一
如何将我的模型包含在 rebuild_index 的索引中? 运行python manage.pyrebuild_index -v2输出: WARNING: This will irreparably
我想为 django-haystack 使用 elasticsearch 引擎。我能够成功安装每个模块和包。 我运行这个命令 sudo service elasticsearch start ,下面是
我正在使用 java 1.7.0_95、Django 1.8.4、Python 3.4.0、Django Rest Framework 3.1 .3、ElasticSearch 2.3.1、pyela
我正在尝试为只搜索单词的一部分(如果我没记错的话,根据 Haystack 文档称为 autocomplete)实现生成结果。 示例: 搜索 "gol" 结果 "goldfish" 我尝试了什么? 我按
我是一名优秀的程序员,十分优秀!