Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [Errno 8] nodename nor servname provided, or not known

pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [Errno 8] nodename nor servname provided, or not known

When I try to insert data into mongodb, the error appears.

mongodb service is already started.

I can't open 'localhost' only on Safari, can open it on Chrome.(can open '127.0.0.1' on both).

my hosts '127.0.0.1 localhost'

like image 556
eason Avatar asked Nov 18 '22 08:11

eason


1 Answers

This is a pymongo configuration error. Make sure dnspython module is installed:

pip install dnspython
like image 197
ttfreeman Avatar answered Dec 14 '22 22:12

ttfreeman