File tree Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change 1
- from django .core .exceptions import ImproperlyConfigured
2
1
from django .db .backends .base .base import BaseDatabaseWrapper
3
2
from django .db .backends .signals import connection_created
4
3
from pymongo .collection import Collection
@@ -161,17 +160,14 @@ def _connect(self):
161
160
self .connection = MongoClient (
162
161
host = settings_dict ["HOST" ] or None ,
163
162
port = int (settings_dict ["PORT" ] or 27017 ),
163
+ username = settings_dict .get ("USER" ),
164
+ password = settings_dict .get ("PASSWORD" ),
164
165
** settings_dict ["OPTIONS" ],
165
166
)
166
167
db_name = settings_dict ["NAME" ]
167
168
if db_name :
168
169
self .database = self .connection [db_name ]
169
170
170
- user = settings_dict ["USER" ]
171
- password = settings_dict ["PASSWORD" ]
172
- if user and password and not self .database .authenticate (user , password ):
173
- raise ImproperlyConfigured ("Invalid username or password." )
174
-
175
171
self .connected = True
176
172
connection_created .send (sender = self .__class__ , connection = self )
177
173
You can’t perform that action at this time.
0 commit comments