mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
update
This commit is contained in:
@@ -196,10 +196,11 @@ def mongdbClientS():
|
|||||||
mg_root = pSqliteDb('config').where('id=?', (1,)).getField('mg_root')
|
mg_root = pSqliteDb('config').where('id=?', (1,)).getField('mg_root')
|
||||||
|
|
||||||
if auth == 'disabled':
|
if auth == 'disabled':
|
||||||
client = pymongo.MongoClient(host=ip, port=int(port), directConnection=True)
|
client = pymongo.MongoClient(host=ip, port=int(port))
|
||||||
else:
|
else:
|
||||||
# print(auth,mg_root)
|
# print(auth,mg_root)
|
||||||
client = pymongo.MongoClient(host=ip, port=int(port), directConnection=True, username='root',password=mg_root)
|
# 使用 admin 数据库进行认证,兼容 MongoDB 3.0
|
||||||
|
client = pymongo.MongoClient(host=ip, port=int(port), username='root', password=mg_root, authSource='admin')
|
||||||
return client
|
return client
|
||||||
|
|
||||||
def mongdbClient():
|
def mongdbClient():
|
||||||
@@ -210,11 +211,12 @@ def mongdbClient():
|
|||||||
mg_root = pSqliteDb('config').where('id=?', (1,)).getField('mg_root')
|
mg_root = pSqliteDb('config').where('id=?', (1,)).getField('mg_root')
|
||||||
# print(ip,port,auth,mg_root)
|
# print(ip,port,auth,mg_root)
|
||||||
if auth == 'disabled':
|
if auth == 'disabled':
|
||||||
client = pymongo.MongoClient(host=ip, port=int(port), directConnection=True)
|
client = pymongo.MongoClient(host=ip, port=int(port))
|
||||||
else:
|
else:
|
||||||
# uri = "mongodb://root:"+mg_root+"@127.0.0.1:"+str(port)
|
# uri = "mongodb://root:"+mg_root+"@127.0.0.1:"+str(port)
|
||||||
# client = pymongo.MongoClient(uri)
|
# client = pymongo.MongoClient(uri)
|
||||||
client = pymongo.MongoClient(host=ip, port=int(port), directConnection=True, username='root',password=mg_root)
|
# 使用 admin 数据库进行认证,兼容 MongoDB 3.0
|
||||||
|
client = pymongo.MongoClient(host=ip, port=int(port), username='root', password=mg_root, authSource='admin')
|
||||||
return client
|
return client
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -122,11 +122,12 @@ def mongdbClient():
|
|||||||
mg_root = pSqliteDb('config').where('id=?', (1,)).getField('mg_root')
|
mg_root = pSqliteDb('config').where('id=?', (1,)).getField('mg_root')
|
||||||
# print(ip,port,auth,mg_root)
|
# print(ip,port,auth,mg_root)
|
||||||
if auth == 'disabled':
|
if auth == 'disabled':
|
||||||
client = pymongo.MongoClient(host=ip, port=int(port), directConnection=True)
|
client = pymongo.MongoClient(host=ip, port=int(port))
|
||||||
else:
|
else:
|
||||||
# uri = "mongodb://root:"+mg_root+"@127.0.0.1:"+str(port)
|
# uri = "mongodb://root:"+mg_root+"@127.0.0.1:"+str(port)
|
||||||
# client = pymongo.MongoClient(uri)
|
# client = pymongo.MongoClient(uri)
|
||||||
client = pymongo.MongoClient(host=ip, port=int(port), directConnection=True, username='root',password=mg_root)
|
# 使用 admin 数据库进行认证,兼容 MongoDB 3.0
|
||||||
|
client = pymongo.MongoClient(host=ip, port=int(port), username='root', password=mg_root, authSource='admin')
|
||||||
return client
|
return client
|
||||||
|
|
||||||
class backupTools:
|
class backupTools:
|
||||||
|
|||||||
Reference in New Issue
Block a user