diff --git a/{{cookiecutter.repo_name}}/compose/pycharm/README.md b/{{cookiecutter.repo_name}}/compose/pycharm/README.md index 34953ff11..903c430f2 100644 --- a/{{cookiecutter.repo_name}}/compose/pycharm/README.md +++ b/{{cookiecutter.repo_name}}/compose/pycharm/README.md @@ -1,58 +1,42 @@ -docker-pycharm-python [![Docker Build Status](http://hubstatus.container42.com/tehsphinx/docker-pycharm-python)](https://registry.hub.docker.com/u/tehsphinx/docker-pycharm-python/) -==== +# Run/Debug Configuration (for PyCharm) -Easy to use and [fig](http://www.fig.sh/index.html) compatible Python development box to be used with [PyCharm (JetBrains)](https://www.jetbrains.com/pycharm/). -This box is NOT meant to be used in production. It comes with SSH/SFTP for PyCharm access. +## Run debug docker container -For me this was a test to see if docker could be used as a "vagrant replacement" especially when it comes down to -running unit tests and debugging from PyCharm IDE. So far it looks promising... +To debug python code inside a docker container, you have to first run: -Note: SSH/SFTP User and Password implementation is based on [atmoz/sftp](https://registry.hub.docker.com/u/atmoz/sftp), -but changed to use ENV variables for fig support. + $ docker-compose -f debug.yml up + +Container should be ready, when -Usage ------ + ... + debug_1 | Starting OpenBSD Secure Shell server: sshd + ... -Best used with [fig](http://www.fig.sh/index.html). +will be displayed in docker-compose logs. -Example --------- +## First time configuration -Dockerfile +If you haven't configure it yet, enable django support for your project: -``` -# Pull base image. -FROM tehsphinx/docker-pycharm-python + -# copy application to image -ADD . /data/ -WORKDIR /data +Next, you have to add python intepreter which is inside docker as remote interpreter: -# If needed: -# install any python requirements found in requirements.txt (this file must be in root path of your app) -RUN pip install -r requirements.txt -``` + + + + + +The last thing, you have to properly setup you Run/Debug Configuration. Make sure, that you use host 0.0.0.0. + + + + +## How to debug? + +Having configuration prepared, simply run your "run" debug configuration: + + -Configuration for fig (fig.yml) -``` -web: - build: . - command: python app.py - ports: - - "8080:8080" - - "2222:22" - volumes: - - .:/data - environment: - SFTP_USER: docker - SFTP_PASS: docker - links: - - db -db: - image: postgres -``` -This samples a web server app (app.py) running on port 8080. PyCharm will be able to access the docker image with the -given user and on port 2222. If you do not want to store your password in plain text, you can use the -Environment Variable "PASS_ENCRYPTED: true" to create the user with the already encrypted password. diff --git a/{{cookiecutter.repo_name}}/compose/pycharm/pycharm_configuration/1.png b/{{cookiecutter.repo_name}}/compose/pycharm/pycharm_configuration/1.png new file mode 100644 index 000000000..01c3cbb2b Binary files /dev/null and b/{{cookiecutter.repo_name}}/compose/pycharm/pycharm_configuration/1.png differ diff --git a/{{cookiecutter.repo_name}}/compose/pycharm/pycharm_configuration/2.png b/{{cookiecutter.repo_name}}/compose/pycharm/pycharm_configuration/2.png new file mode 100644 index 000000000..60ff37d76 Binary files /dev/null and b/{{cookiecutter.repo_name}}/compose/pycharm/pycharm_configuration/2.png differ diff --git a/{{cookiecutter.repo_name}}/compose/pycharm/pycharm_configuration/3.png b/{{cookiecutter.repo_name}}/compose/pycharm/pycharm_configuration/3.png new file mode 100644 index 000000000..30b61f651 Binary files /dev/null and b/{{cookiecutter.repo_name}}/compose/pycharm/pycharm_configuration/3.png differ diff --git a/{{cookiecutter.repo_name}}/compose/pycharm/pycharm_configuration/4.png b/{{cookiecutter.repo_name}}/compose/pycharm/pycharm_configuration/4.png new file mode 100644 index 000000000..693ad5aec Binary files /dev/null and b/{{cookiecutter.repo_name}}/compose/pycharm/pycharm_configuration/4.png differ diff --git a/{{cookiecutter.repo_name}}/compose/pycharm/pycharm_configuration/5.png b/{{cookiecutter.repo_name}}/compose/pycharm/pycharm_configuration/5.png new file mode 100644 index 000000000..98d973a5a Binary files /dev/null and b/{{cookiecutter.repo_name}}/compose/pycharm/pycharm_configuration/5.png differ