def prepare(self): """ peewee的连接池, request-hook(请求前连接) :return: """ db_mysql.connect() return super(BaseRequestHandler, self).prepare()
def wrapper(*args, **kwargs): db_mysql.connect() method(*args, **kwargs) if not db_mysql.is_closed(): db_mysql.close()