*Hello Django Users,*

Need some support on database connectivity in my django application. It's
trying to connect with localhost even after specifying the IP address.
Getting below error, could someone pls look into this?

*Error - *
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File
"/app/pkg/venv/lib/python3.6/site-packages/django/utils/autoreload.py",
line 64, in wrapper
    fn(*args, **kwargs)
  File
"/app/pkg/venv/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
line 121, in inner_run
    self.check_migrations()
  File
"/app/pkg/venv/lib/python3.6/site-packages/django/core/management/base.py",
line 486, in check_migrations
    executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
  File
"/app/pkg/venv/lib/python3.6/site-packages/django/db/migrations/executor.py",
line 18, in __init__
    self.loader = MigrationLoader(self.connection)
  File
"/app/pkg/venv/lib/python3.6/site-packages/django/db/migrations/loader.py",
line 53, in __init__
    self.build_graph()
  File
"/app/pkg/venv/lib/python3.6/site-packages/django/db/migrations/loader.py",
line 220, in build_graph
    self.applied_migrations = recorder.applied_migrations()
  File
"/app/pkg/venv/lib/python3.6/site-packages/django/db/migrations/recorder.py",
line 77, in applied_migrations
    if self.has_table():
  File
"/app/pkg/venv/lib/python3.6/site-packages/django/db/migrations/recorder.py",
line 56, in has_table
    tables = self.connection.introspection.table_names(cursor)
  File
"/app/pkg/venv/lib/python3.6/site-packages/django/db/backends/base/introspection.py",
line 52, in table_names
    return get_names(cursor)
  File
"/app/pkg/venv/lib/python3.6/site-packages/django/db/backends/base/introspection.py",
line 47, in get_names
    return sorted(ti.name for ti in self.get_table_list(cursor)
  File "/app/pkg/venv/lib/python3.6/site-packages/djongo/introspection.py",
line 47, in get_table_list
    for c in cursor.db_conn.list_collection_names()
  File "/app/pkg/venv/lib/python3.6/site-packages/pymongo/database.py",
line 875, in list_collection_names
    return [result["name"] for result in
self.list_collections(session=session, **kwargs)]
  File "/app/pkg/venv/lib/python3.6/site-packages/pymongo/database.py",
line 827, in list_collections
    return self.__client._retryable_read(_cmd, read_pref, session)
  File "/app/pkg/venv/lib/python3.6/site-packages/pymongo/mongo_client.py",
line 1364, in _retryable_read
    server = self._select_server(read_pref, session, address=address)
  File "/app/pkg/venv/lib/python3.6/site-packages/pymongo/mongo_client.py",
line 1196, in _select_server
    server = topology.select_server(server_selector)
  File "/app/pkg/venv/lib/python3.6/site-packages/pymongo/topology.py",
line 251, in select_server
    servers = self.select_servers(selector, server_selection_timeout,
address)
  File "/app/pkg/venv/lib/python3.6/site-packages/pymongo/topology.py",
line 212, in select_servers
    server_descriptions = self._select_servers_loop(selector,
server_timeout, address)
  File "/app/pkg/venv/lib/python3.6/site-packages/pymongo/topology.py",
line 229, in _select_servers_loop
    % (self._error_message(selector), timeout, self.description)
pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [Errno 111]
Connection refused, Timeout: 30s, Topology Description:
<TopologyDescription id: 631eccdca398f528dedcc238, topology_type: Unknown,
servers: [<ServerDescription ('localhost', 27017) server_type: Unknown,
rtt: None, error=AutoReconnect('localhost:27017: [Errno 111] Connection
refused',)>]>

*settings.py - DB part*

*-----------------------------*

DATABASES = {
    'default': {
        'ENGINE': 'djongo',
        'NAME': 'app_db',
        'USER': 'app_user',
        'PASSWORD': 'app_pwd',
        'HOST': '10.111.0.1',
        'PORT': '27017'
    }
}


Thanks,
Prabakaran

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK7fxT_UiuBQpoesAR4W12epW2dH9tfsAh4Q8kqycPExANTsEg%40mail.gmail.com.

Reply via email to