예제 #1
0
파일: DB.py 프로젝트: huangqina/DB
def re():
    global c 
    c = connect2()
    global db
    db = c['tttt']
예제 #2
0
파일: DB.py 프로젝트: huangqina/DB
#logger.info('this is information')
#logger.warn('this is warning message')
#logger.error('this is error message')
#logger.fatal('this is fatal message, it is same as logger.critical')
#logger.critical('this is critical message')
 
# 2016-10-08 21:59:19,493 INFO    : this is information
# 2016-10-08 21:59:19,493 WARNING : this is warning message
# 2016-10-08 21:59:19,493 ERROR   : this is error message
# 2016-10-08 21:59:19,493 CRITICAL: this is fatal message, it is same as logger.critical
# 2016-10-08 21:59:19,493 CRITICAL: this is critical message
 
# 移除一些日志处理器
#logger.removeHandler(file_handler)

c = connect2()
#connect('ttt', host='mongodb://database:27017,database2:27017', replicaSet='rs', read_preference=ReadPreference.SECONDARY_PREFERRED)

#c = MongoClient('mongodb://0.0.0.0:27017')
#mongo = c.ttt
#conn = MongoReplicaSetClient("192.168.2.25:27017,192.168.2.25:27018", replicaset='rs')
db = c['tttt']
app = Flask(__name__)
def re():
    global c 
    c = connect2()
    global db
    db = c['tttt']
#app.config.update(
    #MONGO_URI='mongodb://127.0.0.1:27017/ttt',
    #MONGO_USERNAME='******',