修复一些BUG

将修改密码的代码逻辑做复用处理,简化代码。
This commit is contained in:
向乐🌌
2021-05-20 12:02:11 +08:00
parent 4ad2a126d8
commit ca84457c1f
9 changed files with 224 additions and 212 deletions

View File

@@ -1,4 +1,5 @@
import datetime
import time
from django_redis import get_redis_connection
@@ -8,11 +9,12 @@ from utils.storage.kvstorage import KvStorage
try:
redis_conn = get_redis_connection()
cache_storage = KvStorage(redis_conn)
cache_storage.set('redis_connection', str(datetime.datetime))
cache_storage.get('redis_connection')
print("Redis连接成功set/get测试通过Token缓存将使用Redis处理")
cache_storage.set('redis_connection', str(datetime.datetime.now()))
redis_get = cache_storage.get('redis_connection')
print("Redis连接成功set/get测试通过--{}Token缓存将使用Redis处理" .format(redis_get))
except Exception as e:
cache_storage = MemoryStorage()
print("Redis无法连接Token缓存将使用MemoryStorage处理")
print("如果确定需要使用Redis作为缓存请排查Redis配置")
print("Exception: {}".format(e))
print("如果确定需要使用Redis作为缓存请排查Redis配置,错误信息如下:")
print("Redis Exception: {}".format(e))