Important! This article assumes you are using the PyCharm EAP 2017.1 release or newer.
- If you are using Docker Toolbox and VirtualBox and PyCharm 2016 or earlier, please see our Docker Toolbox/VirtualBox/PyCharm document instead
- If you are using Docker for Mac/Docker for Windows and PyCharm 2016 or earlier, you can use the
socat -d TCP-LISTEN:2376,range=127.0.0.1/32,reuseaddr,fork UNIX:/var/run/docker.sock- see the https://youtrack.jetbrains.com/issue/IDEA-153973#comment=27-1484220 for more information
- If you are using Docker for Mac/Docker for Windows and PyCharm 2017, keep reading!
Open your Divio project with PyCharm
First, Setup the project locally with Divio.
Then, in PyCharm, open the project in the usual way.
Set up PyCharm and Docker
- Open PyCharm's Settings/Preferences
- Search for Docker in Build, Execution, Deployment
- Select Docker and press the "+" icon (this may set up Docker automatically, possibly with incorrect settings). You will need to set them to:
- API URL (for Macintosh):
- API URL (for Windows):
- Docker Compose executable:
- Allow it to Import credentials from Docker Machine.
Now we need to associate the project with its
- In PyCharm's Settings/Preferences dialog, search for Project Interpreter and select it.
- Click on the settings icon on the right and select Add Remote.
- Select Docker Compose. It should find your project's
docker-compose.ymlfile (not yet supported on Windows).
- For Service, select web.
- Hit OK. It may take a few moments to discover the correct Python interpreter and apply the settings.
Check your project's Run configuration. In the toolbar, you'll be able to Edit configurations.
You should have:
- Run browser:
After saving, your project should now be ready to run, using Control-R or the green Run icon in its toolbar.
Note: not all of these PyCharm's features are available when using Docker - for example, debugging tools will not work.