djongo icon indicating copy to clipboard operation
djongo copied to clipboard

always connect to localhost db

Open tmclouisluk opened this issue 6 years ago • 6 comments

Hi all,

I have followed the guide of db connection config: https://nesdis.github.io/djongo/database-configuration/

However, it always connects to localhost one, not my setting's one.

Does anyone have any idea on this issue?

tmclouisluk avatar Jan 09 '19 15:01 tmclouisluk

my packages versions:

Django	2.0
django-cors-headers	2.4.0	
django-rest-auth	0.9.3	
djangorestframework	3.9.0	
djongo	1.1	
mongoengine	0.16.3	
pip	10.0.1	
pymongo	3.7.2	
urllib3	1.24.1	

my settings

DATABASES = {
    'default': {
        'ENGINE': 'djongo',
        'NAME': 'test_db',
        'HOST': 'somewhere.com',
        'PORT': 27017
    }
}

tmclouisluk avatar Jan 10 '19 09:01 tmclouisluk

have the same problem.

market07 avatar Feb 14 '19 22:02 market07

Same. image

Fortich avatar Feb 18 '20 17:02 Fortich

I am also facing the same issue

venugopalsundaram avatar Oct 19 '20 07:10 venugopalsundaram

Any news on this!

obayesshelton avatar Nov 09 '21 10:11 obayesshelton

I came through the same error and it seems that the settings for the DATABASE where changed https://stackoverflow.com/questions/54125152/django-always-connects-to-localhost-mongodb

try to update the settings like this

DATABASES = {
  'default': {  
    'ENGINE':   'djongo',
    'NAME':     'yourmongodb',
    'CLIENT': {
      'host': 'some-host.or.ip',
      'port': 27017,
      'username': 'youruser',
      'password': 'yourdbpass',
      'authSource': 'yourcollection',
    }
  },
}

davidchieregato avatar Dec 07 '21 16:12 davidchieregato