本文整理匯總了Python中motor.MotorClient方法的典型用法代碼示例。如果您正苦於以下問題:Python motor.MotorClient方法的具體用法?Python motor.MotorClient怎麽用?Python motor.MotorClient使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類motor
的用法示例。
在下文中一共展示了motor.MotorClient方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: import motor [as 別名]
# 或者: from motor import MotorClient [as 別名]
def __init__(self):
base_dir = os.path.dirname(__file__)
settings = {
'cookie_secret' : 'A231EJRJ213OEJWNE',
'login_url' : '/login',
'template_path' : os.path.join(base_dir, 'templates'),
'static_path' : os.path.join(base_dir, 'static'),
'debug' : True,
'xsrf_cookies' : False,
}
tornado.web.Application.__init__(self, [
tornado.web.url(r"/", MainHandler, name="main"),
], **settings)
self.db = motor.MotorClient('localhost').testdb
示例2: __init__
# 需要導入模塊: import motor [as 別名]
# 或者: from motor import MotorClient [as 別名]
def __init__(self):
base_dir = os.path.dirname(__file__)
handler_list = handlers.get_handlers
settings = {
'cookie_secret' : 'A32IOJDSOP2PPAAA11',
'login_url' : '/login',
'template_path' : os.path.join(base_dir, 'templates'),
'static_path' : os.path.join(base_dir, 'static'),
'debug' : True,
'xsrf_cookies' : False,
}
tornado.web.Application.__init__(self, handlers=handler_list, **settings)
self.db = motor.MotorClient('localhost').testdb
示例3: post
# 需要導入模塊: import motor [as 別名]
# 或者: from motor import MotorClient [as 別名]
def post(self):
db = motor.MotorClient('localhost').testdb
getusername = self.get_argument('username')
getpassword = self.get_argument('password')
check = yield db.userinfo.find_one(dict(username=getusername))
logging.warning(check)
if check == None :
hashed_pw = get_hash(getpassword)
insert_check = yield db.userinfo.insert(dict(username=getusername,
password=hashed_pw))
self.redirect("/")
else : self.redirect("/register")
示例4: load
# 需要導入模塊: import motor [as 別名]
# 或者: from motor import MotorClient [as 別名]
def load():
for name, config in MongoDB._cofing.items():
MongoDB._conns[name] = motor.MotorClient(max_pool_size=128, tz_aware=True, **config)