mongodb客户端连接mongodb server

 

import pymongo
import sys
import os
sys.path.append(os.path.split(os.path.realpath(__file__))[0]+"/../../")
from Config import ProductionConfig
db_conn = pymongo.MongoClient(ProductionConfig.DB, ProductionConfig.PORT)
na_db = getattr(db_conn, ProductionConfig.DBNAME)
na_db.authenticate(ProductionConfig.DBUSERNAME, ProductionConfig.DBPASSWORD)
NA_INFO = na_db.Info
NA_HISTORY = na_db.History

 

posted @ 2017-03-24 17:15  八月的男人  阅读(464)  评论(0编辑  收藏  举报