I have a strange issue that I can't seem to get to the bottom of. My django project is set up using docker-compose
version: '2'
services:
db:
image: postgres:9.6.0
environment:
POSTGRES_PASSWORD: docker
POSTGRES_USER: docker
ports:
- "8001:5432"
djweb:
build: .
command: python dj/manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
- db
and dockerfile is
FROM python:3.5.2
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD . /code/
In Pycharm I started a new Django project configured with docker compose and it was created just fine. When I try to debug it I get the usual:
warning: Debugger speedups using cython not found. Run '"/usr/local/bin/python" "/opt/.pycharm_helpers/pydev/setup_cython.py" build_ext --inplace' to build. pydev debugger: process 1 is connecting
And now the problem. I can't seem to be able to run that setup_cython command that Pycharm suggests on my 'djweb' container due to a strange read-only error. I would appreciate if anyone can point me in the right direction (I probably need to add some volume to my container or ??? - apparently pycharm also adds other images/containers alongside mine)
root@b8bf92996472:/# "/usr/local/bin/python" "/opt/.pycharm_helpers/pydev/setup_cython.py" build_ext --inplace
running build_ext building '_pydevd_bundle.pydevd_cython' extension creating build error: could not create 'build': Read-only file system
I was running into the same problem and was able to solve it with a command this way:
docker run -t -i --volumes-from pycharm_helpers_PY-163.10154.50 IMAGE_NAME \
/usr/bin/python /opt/.pycharm_helpers/pydev/setup_cython.py build_ext --inplace
You would likely need to replace 163.10154.50
with your own instance - I found mine in PyCharm ->View
->Tool Windows
->Docker
, in the view that pops up, under Docker
->Containers
.
IMAGE_NAME can be found with docker ps
Note - On my configuration I use docker-machine and need to run eval $(docker-machine env)
from Terminal first.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With