3

链接到说明

我正在按照http://read-the-docs.readthedocs.org/en/latest/install.html#solr-search-setup上的说明进行操作

问题

目前,我可以设置 readthedocs.org 的本地实例;但是,我无法正确设置搜索,因为我似乎无法通过运行以下命令生成必要的 schema.xml 文件。其中的上下文在上面的链接中。

./manage.py build_solr_schema > $SOLR_PATH/solr/conf/schema.xml

我没有成功生成 schema.xml,而是出现了这个错误。

Traceback (most recent call last):
  File "./manage.py", line 11, in <module>
    execute_from_command_line(sys.argv)
  File "/home/***/ford-env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/home/***/ford-env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/***/ford-env/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/***/ford-env/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/home/***/ford-env/local/lib/python2.7/site-packages/haystack/management/commands/build_solr_schema.py", line 26, in handle
    schema_xml = self.build_template(using=using)
  File "/home/***/ford-env/local/lib/python2.7/site-packages/haystack/management/commands/build_solr_schema.py", line 52, in build_template
    c = self.build_context(using=using)
  File "/home/***/ford-env/local/lib/python2.7/site-packages/haystack/management/commands/build_solr_schema.py", line 38, in build_context
    raise ImproperlyConfigured("'%s' isn't configured as a SolrEngine)." % backend.connection_alias)

我猜有一个额外的步骤涉及在生成 xml 之前使用 django 配置 solr。类似的错误建议编辑 settings.py 文件,但我似乎无法在项目目录中找到一个。由于我对 django 不熟悉,我不知道如何从这里继续。

4

1 回答 1

3

您必须更新 readthedocs.org/readthedocs/settings/*.py 中的设置文件并更新 HAYSTACK_CONNECTIONS 字典(如果您使用的是 solr):

HAYSTACK_CONNECTIONS = {
'default': {
    'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
    'URL': 'http://127.0.0.1:8983/solr',
    }
}

检查初始化.py、base.py、sqlite.py。然后它完美地工作了。

于 2014-10-09T18:47:11.893 回答