首页 > 代码库 > mongodb客户端连接mongodb server

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

 

mongodb客户端连接mongodb server