Django as backend in a MongoDB-Angular app

I am asking this question here because I believe one or some of my Django settings might be wrong…

Having read through a lot of posts on the following error, I have understood that if you connect to your MongoDB database via pymongo, you should remove the DATABASES section in your settings.py file:

settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

I have removed it, but I still get this error. Nonetheless, I have tried the suggestions in related posts, to no avail…

In my settings.py file, I have my database connection:

DB_NAME = 'mongodb+srv://User2021:TestMe@cluster0.j9jz1.mongodb.net/test'

In my views.py file, I have written a simple method, just to start off:

@csrf_exempt
def consumers(request):
    print("consumers")
    data = ConsumerModel.objects.all()
    if request.method == 'GET':
        serializer = ConsumerModelSerializer(data, many=True)
        return JsonResponse(serializer.data, safe=False)

When I enter the http://localhost:8000/consumers/, I just wanna see that the python print statement writes consumers.

What am I missing?

PyMongo does not replace a relational database with MongoDB. It is simply a facility allowing you to access a MongoDB in addition to your regular database. You still need your databases settings.

It seems that you are using Django with MongoDB and trying to connect to MongoDB through the PyMongo driver. The error message you are getting suggests that the DATABASES setting in your settings.py file is not configured correctly.

However, since you are not using a traditional relational database, you do not need to use the DATABASES setting in your settings.py file. Instead, you can remove the DATABASES setting

This is not an accurate statement. Django requires that there be a DATABASES setting and that it must contain a 'default' entry. See: DATABASES