Pycharm + docker-compose, django server is not responding!


Everything runs fine, breakpoints run, debugger is connected, the runserver command runs properly and the server is started.


Whenever I send a request to that server though, there is server not found!



Recreating django_server ... 
Attaching to django_server
django_server | pydev debugger: starting
django_server |
Connected to pydev debugger (build 183.5429.31)
django_server | pydev debugger: New process is launching (breakpoints won't work in the new process).
django_server | pydev debugger: To debug that process please enable 'Attach to subprocess automatically while debugging?' option in the debugger settings.
django_server |
django_server | Performing system checks...
django_server |
django_server | System check identified no issues (0 silenced).
django_server | February 03, 2019 - 08:52:09
django_server | Django version 2.1.5, using settings 'config.settings'
django_server | Starting development server at
django_server | Quit the server with CONTROL-C.

docker ps:

CONTAINER ID        IMAGE                   COMMAND                  CREATED             STATUS              PORTS                                                         NAMES

34f7bd877cec        django_server           "python -u /opt/.pyc…"   5 minutes ago       Up 5 minutes>51150/tcp, 52291/tcp,>8000/tcp   django_server


The container has the open ports and everything should be fine, but it doesn't respond to any requests! When I run the docker-compose myself, it works well but no debugging offcourse!



Please elaborate on what do you mean by "server not found" ?

You're not getting a response on HTTP request? Is the execution paused on any breakpoint in that moment?


The request doesn't reach the server, host not found. like If I would access a server that does not exist


Please specify what kind of request are you taking about and how do you send it.

Is it working if you run the configuration without debugger from PyCharm?


Same issue here. I'm making a request from a browser to the django server running in the container. Tried both and to no avail. Both used to work in previous versions of pycharm. Mine also works if I run it from terminal with `docker-compose -f local.yml up`



So you are able to open in your browser but then you cannot make any requests?


Correct. For example, Firefox and cURL say they fail because “connection was reset”


Do you have the same problem if you start your Django server from the system terminal (outside of PyCharm) by running the same command PyCharm does?


When I run it from a terminal instead of a PyCharm run config, it connects and the site works. When using the run config, it won't connect.


Hmmm, that's odd.

There is probably something in run configuration that causing this since when you run the same command as PyCharm from the system terminal and it doesn't have this issue.

Does it work with our example from the documentation There is a link to a project on GitHub.

I tried to reproduce on different OS, but it works fine.


Hi same error for me, I'm using Pycharm 2019.1. When I use command line my django app works fine, but not when I use pycharm. when I check the configuration. I see that Pycharm override my docker-compose configuration. If I check this config I see 


- "/usr/bin/python3"
- "-u"
- "/opt/project/"
- "runserver"
- "8000"
PYTHONPATH: "/opt/project:/opt/.pycharm_helpers/pycharm_matplotlib_backend:/opt/.pycharm_helpers/pycharm_display"
DJANGO_SETTINGS_MODULE: "five_backend.settings.local"
stdin_open: true
- "/Users/yavin4/dev/five-backend:/opt/project:rw"
- "pycharm_helpers_PY-191.6183.50:/opt/.pycharm_helpers"
working_dir: "/opt/project"
pycharm_helpers_PY-191.6183.50: {}


the port 8000 is not shared. between the host and the container. and I cannot override this config. 


PyCharm just adds its own configuration file with needed settings, it doesn't overwrite your config(s).

Does it work with our example from the documentation There is a link to a project on GitHub.


Please sign in to leave a comment.