The important thing in this configuration dialog is to set the "Host" field to 0.0.0.0.Ĭlick "OK" to save the configuration. Next click the "+" button and choose "Django server". Now that we've configured P圜harm to be able to connect to Docker and created a remote interpreter configuration based on the Docker Compose file, we can create a Run/Debug configuration.Ĭlick on the "Add configuration." button at the top of the P圜harm window. All other services in your Docker Compose file will start when we later run the configuration in P圜harmīack in the "Python Interpreter" setting dialog you should now see that the project has the correct remote interpreter.Ĭlose the settings. The debugger attaches specifically to the web service. env.dev depends_on : - db db : image : postgres:12.0-alpine volumes : - postgres_data:/var/lib/postgresql/data/ environment : - POSTGRES_USER=hello_django - POSTGRES_PASSWORD=hello_django - POSTGRES_DB=hello_django_dev volumes : postgres_data : app command : python manage.py runserver 0.0.0.0:8000 volumes :. The "Configuration file(s)" field should point to your Docker Compose file while the "Service" field should point to the web application service from your Docker Compose file.įor example, if your Docker Compose file looks like this, then you'll want to point to the web service: In the next dialog, choose "Docker Compose" in the left pane, and select the Docker configuration you created in the previous steps in the "Server" field. Assuming you have a project open, open the settings once again and expand the "Project: " setting and click "Python Interpreter". Now that we have the Docker configuration set up, it's time to configure Docker Compose as a remote interpreter.
#Pycharm docker for mac
Click "Docker" and then click the "+" button to create a new Docker configuration.įor Mac, select the Docker for Mac options. To do so, open P圜harm settings ( P圜harm > Preferences for Mac users or File > Settings for Windows and Linux users), and then expand the "Build, Execution, Deployment" setting.
#Pycharm docker how to
The first step we need to do is to tell P圜harm how to connect to Docker.
![pycharm docker pycharm docker](https://tks2.co.jp/wp-content/uploads/2020/01/pycharm_docker_python.png)
By the end of this tutorial, you should be able to do the following in P圜harm: