Exemple #1
0
def init(conf_file, port=''):
    # 载入配置文件
    os.chdir(os.path.join(os.path.dirname(__file__), '..'))
    confs = JsonConfiger.get_instance()
    confs.load_file(conf_file)

    # 初始化日志
    log_cnf = confs.get('logging')
    if log_cnf['config_file'][:1] not in ['/', '\\']:
        log_cnf['config_file'] = os.path.join(
            os.path.dirname(os.path.abspath(conf_file)),
            log_cnf['config_file'])
    Log.set_up(log_cnf, port)
    global logger
    logger = Log().getLog()

    #各模块配置
    db_pool.set_up(confs.get("database"))
    sms.set_up(confs.get("aliyun"))
    # 初始化消息总线
    #xmsgbus.set_up(confs)
    #db_pool.set_up_cache(confs.get("sys_config"))
    gen_verify_code.set_up(confs.get("files"))
    jiuzhao.set_up(confs.get("jiuzhao"))
    lianlian.set_up(confs.get("lianlian"))
    rmq.setup_producer(confs.get("mq/rabbitmq"))
    # 加载业务代码
    import hooks
    ews.load_biz_dir(path._BIZ_PATH)
Exemple #2
0
def init(conf_file):
    # 载入配置文件
    os.chdir(os.path.join(os.path.dirname(__file__), '..'))
    confs = JsonConfiger.get_instance()
    confs.load_file(conf_file)

    # 初始化日志
    log_cnf = confs.get('logging')
    if log_cnf['config_file'][:1] not in ['/', '\\']:
        log_cnf['config_file'] = os.path.join(os.path.dirname(os.path.abspath(conf_file)), log_cnf['config_file'])
    Log.set_up(log_cnf)
    global logger
    logger = Log().getLog()

    # 加载业务代码
    ews.load_biz_dir(path._BIZ_PATH)