From 6f07e1cd69b374a94803001b2a93f463d4c2595a Mon Sep 17 00:00:00 2001 From: Marvin Zhang Date: Fri, 21 Jun 2019 12:33:35 +0800 Subject: [PATCH] fixed issue https://github.com/tikazyq/crawlab/issues/68 --- crawlab/config/config.py | 1 + crawlab/db/manager.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/crawlab/config/config.py b/crawlab/config/config.py index 14380b73..749ecdba 100644 --- a/crawlab/config/config.py +++ b/crawlab/config/config.py @@ -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' diff --git a/crawlab/db/manager.py b/crawlab/db/manager.py index 17d6b1ae..c7eb16e1 100644 --- a/crawlab/db/manager.py +++ b/crawlab/db/manager.py @@ -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]