1👍
✅
You have two things called MongoClient
: the one you imported from pymongo, and the global class you assigned to a lazy object. But in get_connection
, you are attempting to call the first of those, but by then the name has already been rebound to point to the second.
You should change that module-level name to something else.
(Note, none of this has anything to do with Django; it is a pure Python problem.)
Source:stackexchange.com