I am new to programming and can't pass though the migrate point.

`config/setting.py looks like this: 

import os 
import certifi
import djongo
from dotenv import load_dotenv 
from pathlib import Path

# Database configuration for MongoDB using the MONGODB_URI environment variable
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.dummy',  # Dummy engine since we're using MongoDB
        'NAME': 'wideraicluster',  # Name of the MongoDB database (not used)
    }
}

# Get the path to the CA certificate bundle 
ca_cert_path = certifi.where()

# load config from .env file 
load_dotenv()

# Get the MongoDB URI from the environment variable
MONGODB_URI = os.environ.get("MONGODB_URI")

# Ensure the MONGODB_URI is not None before using it
if MONGODB_URI:
    DATABASES['default']['ENGINE'] = 'djongo'
    DATABASES['default']['ENFORCE_SCHEMA'] = False
    DATABASES['default']['NAME'] = 'correct_cluster_name'  # Specify the name of your MongoDB database
    DATABASES['default']['CLIENT'] = {
        'host': 'cluster0.pfose.mongodb.net',
        'username': 'correct_username',
        'password': 'correct_password',
        'authMechanism': 'SCRAM-SHA-1',
    }
`

This is how my libaries's versions

Here, if I try to connect to the Atlas cluster though the db_connection, it connects, take a look at the terminal screenshot pls below

Here it is conencted and shows the existing docs

After changing the password in the connection string in the databases = ... in config/settings.py , It is giving me this error too

What can I do to tackle this problem? I have watched many YouTube videos on how they tackle the settings.py problem but got not much info.

0

There are 0 best solutions below