django错误:连接到localhost; 3312失败,我使用了django-sphinx

时间:2010-02-04 10:29:48

标签: python django django-sphinx

Traceback (most recent call last):

  File "D:\Python25\Lib\site-packages\django\core\servers\basehttp.py", line 280, in run
    self.finish_response()

  File "D:\Python25\Lib\site-packages\django\core\servers\basehttp.py", line 319, in finish_response
    for data in self.result:

  File "D:\Python25\Lib\site-packages\django\http\__init__.py", line 374, in __iter__
    self._iterator = iter(self._container)

  File "D:\zjm_code\sphinx_test\djangosphinx\models.py", line 240, in __iter__
    return iter(self._get_data())

  File "D:\zjm_code\sphinx_test\djangosphinx\models.py", line 404, in _get_data
    self._result_cache = list(self._get_results())

  File "D:\zjm_code\sphinx_test\djangosphinx\models.py", line 530, in _get_results
    results = self._get_sphinx_results()

  File "D:\zjm_code\sphinx_test\djangosphinx\models.py", line 517, in _get_sphinx_results
    raise SearchError, client.GetLastError()

SearchError: connection to localhost;3312 failed ((10061, 'Connection refused'))

接下来是我的代码:

from sphinx_test.models import File
from djangosphinx.models import SphinxSearch
def xx(request):
    return HttpResponse(File.search.query('test'))


urlpatterns = patterns('',
    (r'^$',xx),
)

3 个答案:

答案 0 :(得分:1)

您不使用分号分隔主机和端口,而是使用冒号:即localhost:3312而不是localhost;3312

答案 1 :(得分:1)

什么版本的狮身人面像? Django的狮身人面像?在port中,sphinx使用sphinx.conf作为设置进行了更改。

searchd现在在127.0.0.1:9312上运行。您当然可以在sphinx.con中更改此端口。完成后重新启动searchd

答案 2 :(得分:0)

我认为值得注意的是,如果您忘记转动狮身人面像,您将收到此错误消息。