change db to get_default_database

This commit is contained in:
songmeo 2021-03-31 10:23:48 +03:00
parent 33f3e6171c
commit 35cc25848c
2 changed files with 6 additions and 1 deletions

2
const.py Normal file
View File

@ -0,0 +1,2 @@
import os
MONGO_URI = os.getenv("MONGO_URI", "mongodb://127.0.0.1:27017/kspace_accounting")

View File

@ -8,9 +8,12 @@ import json
import os import os
import pymongo import pymongo
import smtplib import smtplib
import const
app = Flask(__name__) app = Flask(__name__)
mongodb = MongoClient('mongodb://172.21.27.1,172.21.27.2,172.21.27.3:27017/', replicaSet="kspace-mongo-set").kspace_accounting #mongodb = MongoClient('mongodb://172.21.27.1,172.21.27.2,172.21.27.3:27017/', replicaSet="kspace-mongo-set").kspace_accounting
mongodb = MongoClient(const.MONGO_URI)
mongodb = mongodb.get_default_database()
mongodb.authenticate("kspace_accounting", os.environ["MONGO_PASSWORD"]) mongodb.authenticate("kspace_accounting", os.environ["MONGO_PASSWORD"])
DOORBOY_SECRET = os.environ["DOORBOY_SECRET"] DOORBOY_SECRET = os.environ["DOORBOY_SECRET"]