1 安装pymongo2 连接数据库 1 安装pymongo pip install pymongo 2 连接数据库import pymongodef mongo_init1(): db = pymongo.MongoClient(host='0.0.0.0', port=27017, tz_aware=True)def mongo_init2(): db = pymongo.MongoClient('mongodb://0.0.0.0:27017', tz_aware=True)