mongo_log_handlers.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:web_ctp 作者: molebot 项目源码 文件源码
def _connect(self):
        """Connecting to mongo database."""

        try:
            self.connection = Connection(host=self.host, port=self.port)
        except AutoReconnect, e:
            if self.fail_silently:
                return
            else:
                raise AutoReconnect(e)

        self.db = self.connection[self.database_name]
        if self.username is not None and self.password is not None:
            self.authenticated = self.db.authenticate(self.username, self.password)
        if self.collection_name not in self.db.collection_names():
            self.db.create_collection(self.collection_name,size=512000000,capped=True,max=200)
        self.collection = self.db[self.collection_name]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号