Using pymongo but still getting improperly configured database error

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):
    data = ConsumerModel.objects.all()
    if request.method == 'GET':
        print("consumers")
        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?

Back to Top