I use docker-compose to manage a django app and it's database.
My problem is when I add a specific type of object in the database I have a DoesNotExist
error : .
What I don't understand is that the data IS in the database and i can request it from the django app docker without any problem.
I don't have the issue when I run the app in dev mode with python manage.py runserver
with a local database.
Here is my docker-compose.yml :
version: '3'
services:
dojodb:
image: mysql:5
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_USER: root
MYSQL_DATABASE: dojodb
volumes:
- dojodbvolume:/var/lib/mysql
dojo:
build: .
environment:
- SQLHOST=dojodb
- SQLPORT=3306
- SQLUSER=root
- SQLPWD=password
- DBNAME=dojodb
ports:
- "8000:8000"
depends_on:
- dojodb
volumes:
dojodbvolume:
I really don't see where the problem comes from.
EDIT :
The problem does not come from the connection to the database since I can create and retrieve other types of objects. The DoesNotExist
error only occurs when I ask for products.