Debug in PyCharm - where is the source code in the odoo image?
mikerocker11 opened this issue · 2 comments
Hi,
I recently switched from a source-based installation to a Docker-based setup. Here's the docker-compose.yml file I'm using:
version: '3.1'
services:
web:
image: odoo:17.0
depends_on:
- db
ports:
- "8069:8069"
volumes:
- odoo-web-data:/var/lib/odoo
- ./config:/etc/odoo
- ./addons:/mnt/extra-addons
environment:
- PASSWORD_FILE=/run/secrets/postgresql_password
secrets:
- postgresql_password
db:
image: postgres:15
environment:
- POSTGRES_DB=postgres
- POSTGRES_PASSWORD_FILE=/run/secrets/postgresql_password
- POSTGRES_USER=odoo
- PGDATA=/var/lib/postgresql/data/pgdata
volumes:
- odoo-db-data:/var/lib/postgresql/data/pgdata
secrets:
- postgresql_password
volumes:
odoo-web-data:
odoo-db-data:
secrets:
postgresql_password:
file: odoo_pg_pass
When I was using the source-based installation, I was able to configure PyCharm correctly for debugging. My question is:
Where can I find the source code for the odoo:17.0 image so that I can assign it to a volume, view the code in PyCharm, and set breakpoints?
Where can I find the source code for the odoo:17.0 image so that I can assign it to a volume, view the code in PyCharm, and set breakpoints?
The odoo Dockerfile does a pip install
of the odoo package, so on my odoo:15 pip show odoo
returns Location: /usr/lib/python3/dist-packages
. Now for the unfortunate part. The packaging process changes the file hierarchy a little bit, so I think you will need two volumes at least:
- ./odoo/odoo:/usr/lib/python3/dist-packages/odoo
- ./odoo/addons:/usr/lib/python3/dist-packages/odoo/addons
I haven't tried this myself, as when I get to the level of confusion that makes me want to install a debugger, I write unit tests instead. Another angle of attack might be to try one of the community container images that is already set up for debugging:
You can create a symbolic link. Check my repo: https://github.com/leimantas/odoo-dev/blob/main/odoo