Commit 8d6bf14e authored by 赵威's avatar 赵威

update redis_url

parent a6563515
......@@ -103,7 +103,8 @@ ROOT_URLCONF = 'physical.urls'
WSGI_APPLICATION = 'physical.wsgi.application'
REDIS_URL = "redis://127.0.0.1:6379"
# REDIS_URL = "redis://127.0.0.1:6379"
REDIS_URL = "redis://172.21.52.16.6379"
# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
......
......@@ -144,6 +144,7 @@ def choice_pictorial_push_tag(device_id, user_id):
return {"pictorial_tag_list": []}
# TODO uncomment redis_url
@bind("physical/search/lintag_by_user_id")
def get_lintags_by_user_id(user_id):
try:
......@@ -153,13 +154,13 @@ def get_lintags_by_user_id(user_id):
print("!!!")
linucb_recommend_redis_prefix = "physical:linucb:tag_recommend:device_id:"
device_id = devices[0]
tag_recommend_redis_key = linucb_recommend_redis_prefix + str(device_id)
print(tag_recommend_redis_key)
linucb_recommend_tag_data = redis_client.get(tag_recommend_redis_key)
linucb_recommend_tag_list = json.loads(linucb_recommend_tag_data[:3]) if linucb_recommend_tag_data else []
print(linucb_recommend_tag_list)
redis_key = linucb_recommend_redis_prefix + str(device_id)
print(redis_key)
tag_data = redis_client.get(redis_key)
tag_list = json.loads(tag_data[:3]) if tag_data else []
print(tag_list)
print("=====")
return {"lin_tag_list": linucb_recommend_tag_list}
return {"lin_tag_list": tag_list}
return {"lin_tag_list": []}
except Exception as e:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment