I made a REST framework project in Django using Docker. All of the tests passed without issue. Then I had to move the project “out” of Docker. Not sure if this is an important detail, but just in case.
I created a PostgreSQL on Aiven and connected my project to it. It all works, except one test fails and also, after running them, I get this message:
File "/Users/john/programation/python3/recipe-app-api-out/recipe_env/lib/python3.12/site-packages/django/db/backends/utils.py", line 82, in _execute
return self.cursor.execute(sql)
^^^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.OperationalError: cannot drop the
currently open database
Do you know why this is happening now?
I’m also not sure if the test failing and the dropping issue have to do. The test failing creates and uploads an image, and then tries to delete it with the TearDown
method.
Let me know if there is some specific part of the code I should share to add useful context to the question.