Skip to content
Advertisement

Tag: postgresql

FASTAPI Delete Operation giving Internal server error

I have this code for delete operation on a Postgresql DB: The create and read operations work fine. If I pass an existing or a non-exsiting id to delete, I get a 500 Internal Server error. The row does get deleted from the table though. If I comment this line deleted_post = cursor.fetchone(), it works okay. Here is the error

“Database ‘docker-db’ does not exist”

so I have this problem building django/postgre app with docker. it keeps saying “database does not exist” and quite few time googling doesnt bring any results. I already scrapped the volumes and rebuilt my app few times, followed different guides on how people do the postgres, still no luck making it work for me. Dockerfile compose.yml .env UPDATE: Error messages

Django test uses wrong database in some cases

I try to setup my Django tests, and I noticed that when I run all tests TestRunner uses correct test database (for all aliases): docker-compose exec my_project python manage.py test –keepdb But when I run tests for specific module, it uses the original database: docker-compose exec my_project python manage.py test –keepdb apps.my_module What is the reason of such behavior? Using

Advertisement