This commit is contained in:
Marvin Zhang
2019-06-21 12:33:35 +08:00
parent 312ba656cd
commit 6f07e1cd69
2 changed files with 3 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ MONGO_PORT = 27017
MONGO_USERNAME = None
MONGO_PASSWORD = None
MONGO_DB = 'crawlab_test'
MONGO_AUTH_DB = 'crawlab_test'
# Celery中间者URL
BROKER_URL = 'redis://127.0.0.1:6379/0'

View File

@@ -1,7 +1,7 @@
from bson import ObjectId
from mongoengine import connect
from pymongo import MongoClient, DESCENDING
from config import MONGO_HOST, MONGO_PORT, MONGO_DB, MONGO_USERNAME, MONGO_PASSWORD
from config import MONGO_HOST, MONGO_PORT, MONGO_DB, MONGO_USERNAME, MONGO_PASSWORD, MONGO_AUTH_DB
from utils import is_object_id
connect(db=MONGO_DB, host=MONGO_HOST, port=MONGO_PORT)
@@ -17,6 +17,7 @@ class DbManager(object):
port=MONGO_PORT,
username=MONGO_USERNAME,
password=MONGO_PASSWORD,
authSource=MONGO_AUTH_DB or MONGO_DB,
connect=False)
self.db = self.mongo[MONGO_DB]