'commit'
This commit is contained in:
@@ -4,10 +4,26 @@ import uuid
|
||||
import json
|
||||
|
||||
import redis
|
||||
from Config.Config import (
|
||||
REDIS_HOST, REDIS_PORT, REDIS_DB, REDIS_PASSWORD,
|
||||
REDIS_DECODE_RESPONSES, REDIS_MAX_CONNECTIONS
|
||||
)
|
||||
try:
|
||||
from Config.Config import (
|
||||
REDIS_HOST, REDIS_PORT, REDIS_DB, REDIS_PASSWORD,
|
||||
REDIS_DECODE_RESPONSES, REDIS_MAX_CONNECTIONS
|
||||
)
|
||||
except ModuleNotFoundError:
|
||||
import importlib.util
|
||||
import os
|
||||
_root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
_config_path = os.path.join(_root_dir, "Config", "Config.py")
|
||||
_spec = importlib.util.spec_from_file_location("project_config_fallback", _config_path)
|
||||
_cfg = importlib.util.module_from_spec(_spec)
|
||||
assert _spec.loader is not None
|
||||
_spec.loader.exec_module(_cfg)
|
||||
REDIS_HOST = _cfg.REDIS_HOST
|
||||
REDIS_PORT = _cfg.REDIS_PORT
|
||||
REDIS_DB = _cfg.REDIS_DB
|
||||
REDIS_PASSWORD = getattr(_cfg, "REDIS_PASSWORD", None)
|
||||
REDIS_DECODE_RESPONSES = _cfg.REDIS_DECODE_RESPONSES
|
||||
REDIS_MAX_CONNECTIONS = _cfg.REDIS_MAX_CONNECTIONS
|
||||
# 创建logger实例
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user