diff --git a/{{cookiecutter.repo_name}}/docs/pycharm/configuration.rst b/{{cookiecutter.repo_name}}/docs/pycharm/configuration.rst new file mode 100644 index 00000000..082ea2b4 --- /dev/null +++ b/{{cookiecutter.repo_name}}/docs/pycharm/configuration.rst @@ -0,0 +1,62 @@ +Docker Remote Debugging +======================= + +To connect to python remote interpreter inside docker, you have to make sure first, that Pycharm is aware of your docker. + +Go to *Settings > Build, Execution, Deployment > Docker*. If you are on linux, you can use docker directly using its socket `unix:///var/run/docker.sock`, if you are on Windows or Mac, make sure that you have docker-machine installed, then you can simply *Import credentials from Docker Machine*. + +.. image:: images/1.png + +Configure Remote Python Interpreter +----------------------------------- + +This repository comes with already prepared "Run/Debug Configurations" for docker. + +.. image:: images/2.png + +But as you can see, at the beggining there is something wrong with them. They have red X on django icon, and they cannot be used, withot configuring remote python interpteter. To do that, you have to go to *Settings > Build, Execution, Deployment* first. + + +Next, you have to add new remote python interpreter, based on already tested deployment settings. Go to *Settings > Project > Project Interpreter*. Click on the cog icon, and click *Add Remote*. + +.. image:: images/3.png + +Switch to *Docker Compose* and select `dev.yml` file from directory of your project, next set *Service name* to `django` + +.. image:: images/4.png + +Because Pycharm restarts container every time you use Configuration Run, to not have server restarted during running tests, we defined second service in `dev.yml` file called pycharm. To use it, you have to add interpreter of second service as well. + +.. image:: images/5.png + +The final result should be: + +.. image:: images/6.png + +Having that, click *OK*. Close *Settings* panel, and wait few seconds... + +.. image:: images/7.png + +After few seconds, all *Run/Debug Configurations* should be ready to use. + +.. image:: images/8.png + +**Things you can do with provided configuration**: + +* run and debug python code +.. image:: images/f1.png +* run and debug tests +.. image:: images/f2.png +.. image:: images/f3.png +* run and debug migrations or different django managment commands +.. image:: images/f4.png +* and many others.. + +Known issues +------------ + +* Pycharm hangs on "Connecting to Debugger" + +.. image:: images/issue1.png + +This might be fault of your firewall. Take a look on this ticket - https://youtrack.jetbrains.com/issue/PY-18913 diff --git a/{{cookiecutter.repo_name}}/docs/pycharm/images/1.png b/{{cookiecutter.repo_name}}/docs/pycharm/images/1.png new file mode 100644 index 00000000..06908a12 Binary files /dev/null and b/{{cookiecutter.repo_name}}/docs/pycharm/images/1.png differ diff --git a/{{cookiecutter.repo_name}}/docs/pycharm/images/2.png b/{{cookiecutter.repo_name}}/docs/pycharm/images/2.png new file mode 100644 index 00000000..1fb8cf1e Binary files /dev/null and b/{{cookiecutter.repo_name}}/docs/pycharm/images/2.png differ diff --git a/{{cookiecutter.repo_name}}/docs/pycharm/images/3.png b/{{cookiecutter.repo_name}}/docs/pycharm/images/3.png new file mode 100644 index 00000000..32c93351 Binary files /dev/null and b/{{cookiecutter.repo_name}}/docs/pycharm/images/3.png differ diff --git a/{{cookiecutter.repo_name}}/docs/pycharm/images/4.png b/{{cookiecutter.repo_name}}/docs/pycharm/images/4.png new file mode 100644 index 00000000..cf07f9d8 Binary files /dev/null and b/{{cookiecutter.repo_name}}/docs/pycharm/images/4.png differ diff --git a/{{cookiecutter.repo_name}}/docs/pycharm/images/5.png b/{{cookiecutter.repo_name}}/docs/pycharm/images/5.png new file mode 100644 index 00000000..39fac959 Binary files /dev/null and b/{{cookiecutter.repo_name}}/docs/pycharm/images/5.png differ diff --git a/{{cookiecutter.repo_name}}/docs/pycharm/images/6.png b/{{cookiecutter.repo_name}}/docs/pycharm/images/6.png new file mode 100644 index 00000000..0cd70d24 Binary files /dev/null and b/{{cookiecutter.repo_name}}/docs/pycharm/images/6.png differ diff --git a/{{cookiecutter.repo_name}}/docs/pycharm/images/7.png b/{{cookiecutter.repo_name}}/docs/pycharm/images/7.png new file mode 100644 index 00000000..4f8807e3 Binary files /dev/null and b/{{cookiecutter.repo_name}}/docs/pycharm/images/7.png differ diff --git a/{{cookiecutter.repo_name}}/docs/pycharm/images/8.png b/{{cookiecutter.repo_name}}/docs/pycharm/images/8.png new file mode 100644 index 00000000..05946f2c Binary files /dev/null and b/{{cookiecutter.repo_name}}/docs/pycharm/images/8.png differ diff --git a/{{cookiecutter.repo_name}}/docs/pycharm/images/f1.png b/{{cookiecutter.repo_name}}/docs/pycharm/images/f1.png new file mode 100644 index 00000000..2d8c4b6c Binary files /dev/null and b/{{cookiecutter.repo_name}}/docs/pycharm/images/f1.png differ diff --git a/{{cookiecutter.repo_name}}/docs/pycharm/images/f2.png b/{{cookiecutter.repo_name}}/docs/pycharm/images/f2.png new file mode 100644 index 00000000..b123a478 Binary files /dev/null and b/{{cookiecutter.repo_name}}/docs/pycharm/images/f2.png differ diff --git a/{{cookiecutter.repo_name}}/docs/pycharm/images/f3.png b/{{cookiecutter.repo_name}}/docs/pycharm/images/f3.png new file mode 100644 index 00000000..713ab543 Binary files /dev/null and b/{{cookiecutter.repo_name}}/docs/pycharm/images/f3.png differ diff --git a/{{cookiecutter.repo_name}}/docs/pycharm/images/f4.png b/{{cookiecutter.repo_name}}/docs/pycharm/images/f4.png new file mode 100644 index 00000000..11668ecd Binary files /dev/null and b/{{cookiecutter.repo_name}}/docs/pycharm/images/f4.png differ diff --git a/{{cookiecutter.repo_name}}/docs/pycharm/images/issue1.png b/{{cookiecutter.repo_name}}/docs/pycharm/images/issue1.png new file mode 100644 index 00000000..1bb68eee Binary files /dev/null and b/{{cookiecutter.repo_name}}/docs/pycharm/images/issue1.png differ