Reputation: 2148
I was upgrading my working django project to python3.4. After deploying, I got the following issue!
(The same project works fine under python2.7
with pymongo2.8
flavour.)
I have pymongo3.2
& django-mongo-sessions
along with other libraries
File "/home/ec2-user/py33/local/lib/python3.4/site-packages/mongo_sessions/session.py", line 8, in <module>
from mongo_sessions import settings
File "/home/ec2-user/py33/local/lib/python3.4/site-packages/mongo_sessions/settings.py", line 36, in <module>
MONGO_DB_VERSION = MONGO_CLIENT.connection.server_info()['version']
File "/home/ec2-user/py33/local/lib64/python3.4/site-packages/pymongo/collection.py", line 2348, in __call__
self.__name.split(".")[-1])
TypeError: 'Collection' object is not callable. If you meant to call the 'server_info' method on a 'Collection' object it is failing because no such method exists.
I looked into this issue which looks similar. But I'm pretty sure that I'm using pymongo3.2
itself!
Upvotes: 2
Views: 1027
Reputation: 8909
It looks like django-mongo-sessions has not been updated to support PyMongo 3.x. Your particular problem is that Database.connection was renamed to Database.client in PyMongo 3.0. The failing line of code should be changed to:
MONGO_DB_VERSION = MONGO_CLIENT.client.server_info()['version']
That's probably not the only required change. See the migration guide for details.
Upvotes: 2