The Django's mongodb support library djongo will close the db automatically
I use MongoDB as the Django's database and I use djongo for operation, it seems that it will close the connection automatically and can't restore. For example, I create a simple view to show all the records like before:
book_res = Book.object.all()
...
return Response(res)
It will work in the first time I get to the view's url address, if i refresh the page or redirect into the same url, the system will crash and shows the error message that "cannot use mongoclient after close" that cause an ambigous error "django.db.utils.DatabseError"
Just to make sure, did you ran:
python manage.py makemigrations
And
python manage.py migrate