def connect(): global db db = webpy_db.database(port=port, host=host, dbn='postgres', db=the_db, user=user, pw=pw) print '开始连接数据库 %s' % host
def connect(): global db db = webpy_db.database( port=5432, host=DB_IP, dbn='postgres', db='base', user='******', pw='base') print '开始连接数据库 %s' % DB_IP
def connect(): global db db = webpy_db.database( port=5432, host=host, dbn='postgres', db=the_db, user=user, pw=pw) print '开始连接数据库 %s' % host
def gen_db(self, node_cfg): pool_policy = node_cfg.get('pool_policy', 'default') node_cfg['pooling'], node_cfg['dbn'] = True, 'mysql' node_cfg.update(_pool_policy[pool_policy]) if 'port' in node_cfg: node_cfg['port'] = int(node_cfg['port']) else: node_cfg['port'] = 3306 return database( **{k: v for k, v in node_cfg.items() if k not in _config_fields})