Skip to content

Commit b0ecd75

Browse files
committed
渲染模式下提示安装feapder[render]
1 parent a450fb4 commit b0ecd75

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

feapder/db/redisdb.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66
---------
77
@author: Boris
88
"""
9-
9+
import os
1010
import time
1111

1212
import redis
1313
from redis.connection import Encoder as _Encoder
1414
from redis.exceptions import ConnectionError, TimeoutError
1515
from redis.exceptions import DataError
1616
from redis.sentinel import Sentinel
17-
from rediscluster import RedisCluster
1817

1918
import feapder.setting as setting
2019
from feapder.utils.log import log
@@ -157,6 +156,12 @@ def get_connect(self):
157156
)
158157

159158
else:
159+
try:
160+
from rediscluster import RedisCluster
161+
except ModuleNotFoundError as e:
162+
log.error('请安装 pip install "feapder[all]"')
163+
os._exit(0)
164+
160165
# log.debug("使用redis集群模式")
161166
self._redis = RedisCluster(
162167
startup_nodes=startup_nodes,
@@ -584,7 +589,6 @@ def zexists(self, table, values):
584589
return is_exists
585590

586591
def lpush(self, table, values):
587-
588592
if isinstance(values, list):
589593
pipe = self._redis.pipeline()
590594

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
"requests>=2.22.0",
4343
"bs4>=0.0.1",
4444
"ipython>=7.14.0",
45-
"redis-py-cluster>=2.1.0",
4645
"cryptography>=3.3.2",
4746
"urllib3>=1.25.8",
4847
"loguru>=0.5.3",
@@ -61,6 +60,7 @@
6160
"bitarray>=1.5.3",
6261
"PyExecJS>=1.5.1",
6362
"pymongo>=3.10.1",
63+
"redis-py-cluster>=2.1.0",
6464
] + render_requires
6565

6666
setuptools.setup(

0 commit comments

Comments
 (0)