(已解决)如何run老师的前端代码error: Authentication required.

来源:15-3 django实现elasticsearch的搜索建议 - 1

慕瓜9058083

2022-02-11

老师,我是直接用您的前端代码,run的时候没有lcvsearch,请问我应该怎么运行!
图片描述
图片描述
图片描述

然后我试着再cmd下运行python manage.py runserver,结果是sever error 500
图片描述
图片描述
报错信息是:
redis.exceptions.AuthenticationError: Authentication required.
问题出在view文件下
topn_search = redis_cli.zrevrangebyscore(“search_keywords_set”, “+inf”, “-inf”, start=0, num=5)
需要做什么处理呢?
完整报错信息如下:
Internal Server Error: /
Traceback (most recent call last):
File “D:\Anaconda3\lib\site-packages\django\core\handlers\exception.py”, line 34, in inner
response = get_response(request)
File “D:\Anaconda3\lib\site-packages\django\core\handlers\base.py”, line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File “D:\Anaconda3\lib\site-packages\django\core\handlers\base.py”, line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “D:\Anaconda3\lib\site-packages\django\views\generic\base.py”, line 71, in view
return self.dispatch(request, *args, **kwargs)
File “D:\Anaconda3\lib\site-packages\django\views\generic\base.py”, line 97, in dispatch
return handler(request, *args, **kwargs)
File “D:\coding-92\LcvSearch\search\views.py”, line 17, in get
topn_search = redis_cli.zrevrangebyscore(“search_keywords_set”, “+inf”, “-inf”, start=0, num=5)
File “D:\Anaconda3\lib\site-packages\redis\commands\core.py”, line 3531, in zrevrangebyscore
return self.execute_command(*pieces, **options)
File “D:\Anaconda3\lib\site-packages\redis\client.py”, line 1177, in execute_command
lambda error: self._disconnect_raise(conn, error),
File “D:\Anaconda3\lib\site-packages\redis\retry.py”, line 44, in call_with_retry
fail(error)
File “D:\Anaconda3\lib\site-packages\redis\client.py”, line 1177, in
lambda error: self._disconnect_raise(conn, error),
File “D:\Anaconda3\lib\site-packages\redis\client.py”, line 1163, in _disconnect_raise
raise error
File “D:\Anaconda3\lib\site-packages\redis\retry.py”, line 41, in call_with_retry
return do()
File “D:\Anaconda3\lib\site-packages\redis\client.py”, line 1175, in
conn, command_name, *args, **options
File “D:\Anaconda3\lib\site-packages\redis\client.py”, line 1150, in _send_command_parse_response
return self.parse_response(conn, command_name, **options)
File “D:\Anaconda3\lib\site-packages\redis\client.py”, line 1189, in parse_response
response = connection.read_response()
File “D:\Anaconda3\lib\site-packages\redis\connection.py”, line 800, in File “D:\Anaconda3\lib\site-packages\redis\client.py”, line 1189, in par
se_response
response = connection.read_response()
File “D:\Anaconda3\lib\site-packages\redis\connection.py”, line 800, in
read_response
File “D:\Anaconda3\lib\site-packages\redis\connection.py”, line 800, in read_re
sponse
response = self._parser.read_response(disable_decoding=disable_decoding)
File “D:\Anaconda3\lib\site-packages\redis
\connection.py”, line 800, in read_response
response = self._parser.read_response(di
sable_decoding=disable_decoding)
File “D:\Anaconda3\lib\site-packages\redis\connection.py”, line 336, in read_response
raise error
redis.exceptions.AuthenticationError: Authentication required.

写回答

1回答

慕瓜9058083

提问者

2022-02-13

已解决,是redis数据库我设置了密码

0
1
bobby
好的。。。
2022-02-13
共1条回复

Scrapy打造搜索引擎 畅销4年的Python分布式爬虫课

带你彻底掌握Scrapy,用Django+Elasticsearch搭建搜索引擎

5796 学习 · 6290 问题

查看课程