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

0 投票
3 回答
1197 浏览
提问于 2025-04-15 18:53
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

我觉得值得注意的是,如果你忘记开启sphinx,就会看到这个错误信息。

1

你用的是什么版本的sphinx?还有django-sphinx呢?sphinx的设置文件里用的端口有变动。

现在,searchd运行在127.0.0.1:9312这个地址上。当然,你可以在里更改这个端口。修改完后,记得重启你的searchd

1

在写地址的时候,主机和端口之间用冒号来分隔,而不是用分号。比如说,你应该写 localhost:3312,而不是 localhost;3312

撰写回答