Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoDB URI should include the database #21

Closed
fsouza opened this issue Aug 24, 2011 · 0 comments
Closed

MongoDB URI should include the database #21

fsouza opened this issue Aug 24, 2011 · 0 comments
Labels

Comments

@fsouza
Copy link
Contributor

fsouza commented Aug 24, 2011

For authentication reasons, the MongoDB URI should include the database.

Details, extracted from Flask mailing list:

On Tue, Aug 23, 2011 at 8:41 AM, Ishbir Singh <...> wrote:
Hey,

This throws the same error, but when I try host='mongodb://user:password@188.88.88.2:27017/database', then it works.. I created a user for the database, not for the entire server, because, that would be insecure otherwise.


On 23 August 2011 02:51, Francisco Souza <...> wrote:
Can you execute this code below in the Python interactive console?

>>> import pymongo
>>> conn = pymongo.connection.Connection(host='mongodb://user:password@188.88.88.2:27017') # place your data here
>>> conn.database

Cheers,
Chico (a.k.a Francisco Souza)
@franciscosouza



On Mon, Aug 22, 2011 at 11:21 AM, Ishbir Singh <...> wrote:
Hey, here you go-

Traceback (most recent call last):
  File "manage.py", line 3, in <module>
    from lulzimg import app
  File "/var/script/script/__init__.py", line 25, in <module>
    db.init_app(app)
  File "/usr/local/lib/python2.7/dist-packages/flaskext/mongoalchemy.py", line 108, in init_app
    host=uri,
  File "/usr/local/lib/python2.7/dist-packages/mongoalchemy/session.py", line 83, in connect
    conn = Connection(*args, **kwds)
  File "/usr/local/lib/python2.7/dist-packages/pymongo/connection.py", line 333, in __init__
    raise ConfigurationError("authentication failed")
pymongo.errors.ConfigurationError: authentication failed



On 22 August 2011 18:42, Francisco Souza <...> wrote:
Hey there,

On Mon, Aug 22, 2011 at 8:57 AM, Ishbir Singh <...> wrote:

Hey there,

I realize that this might not be related to Flask in anyway, but I still wanted to get some help. What I have are 2 servers, one running MongoDB server and the other is the client. Now, I'm trying to access the server from the client by using appropriate credentials and port numbers. The connection is successful via the command-line mongo tool but while using the exact same settings with Flask-MongoAlchemy, it says that authentication failed.

Could you please paste the stack trace here? 

Cheers,
Chico (a.k.a Francisco Souza)
@franciscosouza




On Mon, Aug 22, 2011 at 8:57 AM, Ishbir Singh <...> wrote:
Hey there,

I realize that this might not be related to Flask in anyway, but I still wanted to get some help. What I have are 2 servers, one running MongoDB server and the other is the client. Now, I'm trying to access the server from the client by using appropriate credentials and port numbers. The connection is successful via the command-line mongo tool but while using the exact same settings with Flask-MongoAlchemy, it says that authentication failed.

I know that the settings are valid, I know that the firewall is not blocking requests. What could be the fault?

config.py in the client server-

MONGOALCHEMY_DATABASE = 'database'
MONGOALCHEMY_SERVER = '188.88.88.2'
MONGOALCHEMY_USER = 'user'
MONGOALCHEMY_PASSWORD = 'password'

I'm using Flask-MongoAlchemy by the way.

-- 
Regards,
Ishbir Singh





-- 
Regards,
Ishbir Singh





-- 
Regards,
Ishbir Singh
@fsouza fsouza closed this as completed in a5788ce Aug 25, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant