我按照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不熟悉,我不知道如何从这里继续。
答案 0 :(得分:3)
你必须更新readthedocs.org/readthedocs/settings/*.py中的设置文件并更新HAYSTACK_CONNECTIONS dict(如果你使用的是solr):
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
'URL': 'http://127.0.0.1:8983/solr',
}
}
检查 init .py,base.py,sqlite.py。然后它完美地运作了。