DrKaoliN
DrKaoliN

Reputation: 1402

Django MongoDB Engine connection failure

[SOLVED] After successfully completing the django tutorial, I have tried to use mongoDB as a database, with Django MongoDB Engine. This is the database configuration in settings.py:

DATABASES = {
    'default': {
        'ENGINE': 'django_mongodb_engine', 
        'NAME': 'test',                               
        'HOST': 'localhost',               
        'PORT': 27017,                   
#       'OPTIONS' : {
#           'slave_okay' : True,
#       }
    }
}

And this is the error message I get, after running python manage.py syncdb :

raise AutoReconnect("could not find master/primary")
pymongo.errors.AutoReconnect: could not find master/primary

I got this error, even after shutting down the mongoDB server, so I figured out that this needed to be a connection issue. I posted an answer on how I solved this.


Using Ubuntu 12.04 LTS x64, Python 2.7, django 1.4.2, mongoDB x86_64 2.2.1 (clean new install)

Upvotes: 0

Views: 1623

Answers (2)

DrKaoliN
DrKaoliN

Reputation: 1402

The way I solved this is so simple that I am almost ashamed at myself for asking the question in the first place, but I hope it will be useful:

I simply upgraded the Django MongoDB Engine by typing into the terminal:

sudo pip install git+https://github.com/django-nonrel/mongodb-engine --upgrade

And that's it.

Upvotes: 3

juan
juan

Reputation: 81902

Can you try running ...

db.repairDatabase()

... from the mongo terminal?

Upvotes: 0

Related Questions