0

I'm writing an application with django and I want to use mongoDB as my database. But I am unable to connect to it. The error I get is:

ConnectionFailure: [Errno 111] Connection refused

My settings for Connection are:

import mongoengine
_MONGODB_USER = 'root'
_MONGODB_PASSWD = '12345'
_MONGODB_HOST = '192.168.8.101'
_MONGODB_NAME = 'admin'
_MONGODB_DATABASE_HOST = \
    'mongodb://%s:%s@%s/%s' \
    % (_MONGODB_USER, _MONGODB_PASSWD, _MONGODB_HOST, _MONGODB_NAME)

mongoengine.connect(_MONGODB_NAME, host=_MONGODB_DATABASE_HOST)

What am I doing wrong? Any help would be appreciated

Farhat Nawaz
  • 202
  • 5
  • 20
  • Some questions: You mentioned Django containerized app in question. Do you mean a Docker container running you Django app? What about your MongoDB, is it containerized? What are your docker run commands? – Aliakbar Abbasi Sep 04 '17 at 08:06
  • @abilinx Yes, that means a docker container running the app and mongodb is running outside. But never mind, I figured it out myself. Thanks for your reply though. – Farhat Nawaz Sep 04 '17 at 18:17

0 Answers0