搜索提交信息时出现问题

来源:15-9 搜索记录、热门搜索功能实现 - 2

躺着学代码

2018-11-28

TypeError at /search/
zincrby() missing 1 required positional argument: 'value’
Request Method: GET
Request URL: http://127.0.0.1:8000/search/?q=java&s_type=article
Django Version: 2.1.3
Exception Type: TypeError
Exception Value:
zincrby() missing 1 required positional argument: 'value’
Exception Location: C:\Users\Administrator\PycharmProjects\LcvSearch\search\views.py in get, line 68
Python Executable: C:\Users\Administrator\AppData\Local\Programs\Python\Python35\python.exe
Python Version: 3.5.2
Python Path:
[‘C:\Users\Administrator\PycharmProjects\LcvSearch’,
‘C:\Users\Administrator\PycharmProjects\LcvSearch’,
‘C:\Users\Administrator\AppData\Local\Programs\Python\Python35\python35.zip’,
‘C:\Users\Administrator\AppData\Local\Programs\Python\Python35\DLLs’,
‘C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib’,
‘C:\Users\Administrator\AppData\Local\Programs\Python\Python35’,
‘C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages’,
'C:\Program Files\JetBrains\PyCharm '
‘2018.2.5\helpers\pycharm_matplotlib_backend’]
Server time: Wed, 28 Nov 2018 02:26:19 +0000

写回答

2回答

非凡哥大战哥斯拉

2018-11-29

提示说了“Exception Location: C:\Users\Administrator\PycharmProjects\LcvSearch\search\views.py in get, line 68”

在第68行出问题。

zincrby() missing 1 required positional argument: 'value'说的是zincrby()方法传少了一个必要的参数,看看有没有变量写少了呗

另外,可能因为版本问题,bobby老师里面的zincrby()方法没有传入amount值的,我自己后来添加之后就行了redis_cli.zincrby(name="search_keyword_set",value=key_words,amount=1)

1
1
Pandar
谢谢老哥,问题解决了
2019-04-15
共1条回复

bobby

2018-11-29

//img.mukewang.com/szimg/5bffdbe500017af607030139.jpg 新版本的redis的这个接口需要多设置一个值 value, 注释里面有value是什么意思

0
0

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

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

5796 学习 · 6290 问题

查看课程