django错误:连接到本地主机;3312失败,我使用了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),
)
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'))
and next is my code:
from sphinx_test.models import File
from djangosphinx.models import SphinxSearch
def xx(request):
return HttpResponse(File.search.query('test'))
urlpatterns = patterns('',
(r'^
,xx),
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您不使用分号来分隔主机和端口,而是使用冒号:即
localhost:3312
而不是localhost;3312
。You don't use a semicolon to separate host and port, you use a colon: i.e.
localhost:3312
instead oflocalhost;3312
.狮身人面像什么版本? Django 狮身人面像? sphinx 在
sphinx.conf
中设置时使用的端口
发生了变化。searchd
现在在127.0.0.1:9312
上运行。您当然可以在sphinx.con
中更改此端口。执行此操作后重新启动searchd
。What version of sphinx? django-sphinx? There has been a change in the
port
that is used by sphinx as setup insphinx.conf
.The
searchd
now runs on127.0.0.1:9312
. You can of course change this port insphinx.con
. Restart yoursearchd
after you do so.我认为值得注意的是,如果您忘记打开 sphinx,您将收到此错误消息。
I think it's worth noting that if you have forgotten to turn sphinx on you will get this error message.