ConnectionException connecting a REST Eve API to a MongoDB instance

I just installed the "previous demo", I can not get it to start working.

Error:

eve.io.base.ConnectionException: driver initialization failed. Verify that the database server is running. Driver exception: OperationFailure (u "SON command ([('authenticate', 1), ('user', u'user '), (' nonce ', u'cec66353cb35b6f5'), ('key', u'14817e596653376514b76248055e1d4f ' )]) failed: auth failed ",)

I have mongoDB working and I installed Eve and Python2.7.

I create run.py and settings.py .

What does not work? Am I missing something?

+4
source share
2 answers

It looks like the MongoDB user / pw command configured in your settings.py not been installed at the db level. From the mongo shell use <dbname> , then db.system.users.find() to get a list of authorized users for <dbname> . It is probably empty; add the user as needed (see MongoDB docs ).

+6
source
  • get mongodb username and password, username and password from setting.py parameter, for example:

     MONGO_USERNAME = 'username' MONGO_PASSWORD = 'password' MONGO_DBNAME = 'apitest' 
  • log in to the mongod server with mongo and make sure your username is in the dbname system.user collection. You can request authenticated users in this database with the following operation:

     use apitest db.system.users.find() 
  • If the username does not exist in system.users, then you can use the db.addUser command to add the user to system.users collection.eg:

     use apitest db.addUser{'username','password'} 
+4
source

Source: https://habr.com/ru/post/1499692/


All Articles