Hi everyone, I have been trying to use Djongo as my database engine to connect my Django application with a MongoDB database. However, I am facing a lot of issues during a procedure that from tutorials and the djongo documentation seems straightforward. The first issue that I managed to resolve was between 2 libraries required by djongo. The bson and pymongo library had a conflict because the pymongo library had its own version of bson and there was a conflict. For anyone interested I solved this by uninstalling bson through pip from my environment first, then uninstalling pymongo through pip and finally reinstalling pymongo through conda-forge. If anyone needs help solving this let me know.
Moving to my current issue, the only change that I have made is in the project's settings.py according to this tutorial <https://www.youtube.com/watch?v=iKB_4HWKMCc>and this official documentation <https://nesdis.github.io/djongo/integrating-django-with-mongodb/>. *My code: * DATABASES = { 'default': { 'ENGINE': 'djongo', 'NAME': 'my_database', 'HOST': 'mongodb+srv://******:********@cluster0-d6bbl.mongodb.net/my_database?retryWrites=true&w=majority', 'USER': '****', 'PASSWORD': '******', } } where ****** denotes my username and password of my database. It should be noted the database is in the cloud using the MongoDB Atlas. *My environment has this packages:* - asgiref 3.2.7 py_0 - ca-certificates 2020.4.5.2 hecda079_0 conda-forge - certifi 2020.4.5.2 py36h9f0ad1d_0 conda-forge - dataclasses 0.7 pypi_0 pypi - django 3.0.3 py_0 - djongo 1.3.2 pypi_0 pypi - libcxx 10.0.0 1 - libedit 3.1.20181209 hb402a30_0 - libffi 3.3 h0a44026_1 - ncurses 6.2 h0a44026_1 - openssl 1.1.1g h0b31af3_0 conda-forge - pip 20.0.2 py36_3 - pymongo 3.10.1 py36h0130604_1 conda-forge - python 3.6.10 hf48f09d_2 - python-dateutil 2.8.1 pypi_0 pypi - python_abi 3.6 1_cp36m conda-forge - pytz 2020.1 py_0 - readline 8.0 h1de35cc_0 - setuptools 47.1.1 py36_0 - six 1.15.0 pypi_0 pypi - sqlite 3.31.1 h5c1f38d_1 - sqlparse 0.2.4 pypi_0 pypi - tk 8.6.8 ha441bb4_0 - wheel 0.34.2 py36_0 - xz 5.2.5 h1de35cc_0 - zlib 1.2.11 h1de35cc_3 *Error Traceback after running manage.py runserver* 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 "/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/utils/autoreload.py", line 53, in wrapper fn(*args, **kwargs) File "/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 120, in inner_run self.check_migrations() File "/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/core/management/base.py", line 458, in check_migrations executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS]) File "/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/db/migrations/executor.py", line 18, in __init__ self.loader = MigrationLoader(self.connection) File "/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/db/migrations/loader.py", line 49, in __init__ self.build_graph() File "/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/db/migrations/loader.py", line 212, in build_graph self.applied_migrations = recorder.applied_migrations() File "/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/db/migrations/recorder.py", line 76, in applied_migrations if self.has_table(): File "/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/db/migrations/recorder.py", line 56, in has_table return self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()) File "/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/db/backends/base/introspection.py", line 48, in table_names return get_names(cursor) File "/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/django/db/backends/base/introspection.py", line 43, in get_names return sorted(ti.name for ti in self.get_table_list(cursor) File "/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/djongo/introspection.py", line 47, in get_table_list for c in cursor.db_conn.list_collection_names() File "/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/pymongo/database.py", line 856, in list_collection_names for result in self.list_collections(session=session, **kwargs)] File "/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/pymongo/database.py", line 819, in list_collections _cmd, read_pref, session) File "/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1454, in _retryable_read read_pref, session, address=address) File "/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1253, in _select_server server = topology.select_server(server_selector) File "/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/pymongo/topology.py", line 235, in select_server address)) File "/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/pymongo/topology.py", line 193, in select_servers selector, server_timeout, address) File "/Users/ghadjigeorgiou/miniconda3/envs/myenv/lib/python3.6/site-packages/pymongo/topology.py", line 209, in _select_servers_loop self._error_message(selector))pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [Errno 61] Connection refusedThank you for reading this and helping me!* *George* -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/373feeeb-c638-4312-9379-0bba36eb2433o%40googlegroups.com.

