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
21from django .db .backends .base .base import BaseDatabaseWrapper
32from django .db .backends .signals import connection_created
43from pymongo .collection import Collection
@@ -161,17 +160,14 @@ def _connect(self):
161160 self .connection = MongoClient (
162161 host = settings_dict ["HOST" ] or None ,
163162 port = int (settings_dict ["PORT" ] or 27017 ),
163+ username = settings_dict .get ("USER" ),
164+ password = settings_dict .get ("PASSWORD" ),
164165 ** settings_dict ["OPTIONS" ],
165166 )
166167 db_name = settings_dict ["NAME" ]
167168 if db_name :
168169 self .database = self .connection [db_name ]
169170
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-
175171 self .connected = True
176172 connection_created .send (sender = self .__class__ , connection = self )
177173
You can’t perform that action at this time.
0 commit comments