pythondjangomongodbubuntudjango-mongodb-engine

Django and Mongodb, connection refused when using syncdb


I am using django_mongodb_engine so I can use Mongodb as my backend for Django. I am running Ubuntu 12.04.3. However, whenever I use 'python manage.py syncdb', I'm getting this error:

'ConnectionFailure: could not connect to ###.###.##.#:6645 [Errno 111] Connection refused'

Here is what my DATABASE settings look like in the settings.py file:

DATABASES = {
     'default': {
           'ENGINE': 'django_mongodb_engine',
           'NAME': 'DB1',
           'USER': '',
           'PASSWORD': '',
           'HOST': '###.###.##.#',
           'PORT': 6645,
     },
     'Request': {
           'ENGINE': 'django_mongodb_engine',
           'NAME': 'Request',
           'USER': '',
           'PASSWORD': '',
           'HOST': '###.###.##.#',
           'PORT': 6645,
     },
     'Data': {
           'ENGINE': 'django_mongodb_engine',
           'NAME': 'Data',
           'USER': '',
           'PASSWORD': '',
           'HOST': '###.###.##.#',
           'PORT': 6645,
     },
}

Also, my MongoDB database is on a VM. I'm using Django on a separate VM. Not sure if this might be causing a problem as well. I can connect to the database no problem on the VM that has MongoDB, but cannot with the VM that has Django.

This is my first time using Django, so I'm lost as to what the problem could be. I've searched through just about every post related to this but can't seem to find a solution to my problem.

Thanks in advance for any help you can offer!

Also, apology in advance in case I left out in pertinent information.


Solution

  • Well, what worked for me was to create a username and password for my database. For some reason, as soon as I added a value for 'USER' and 'PASSWORD', I was able to connect.