Coder Social home page Coder Social logo

debugging-dockerized-python-app's Introduction

What?

This is example project for my blog entry: Debugging Dockerized Python (Django) App With PyCharm

Usage

  1. Run helper script ./build-core-django.sh. It will build core image.
  2. Run docker compose command: docker-compose -f docker-compose-development.yml up. It will build development image, and then run it with Postgres container.
  3. Check if everything is ok: docker ps. There should be 2 containers running: debuggingdockerizedpythonapp_django_1 and debuggingdockerizedpythonapp_postgres_1. Note that the firs one is forwarding two ports: 2000 for SSH connection and 8080 for webserver.
  4. In PyCharm, add new python interpreter. Choose remote and fill it's configuration with settings:
  • Host: your host ip address (for my docker-mashine: 192.168.99.100)
  • Port: 2000
  • Username: root
  • Password: password
  • Interpreter path: /usr/local/bin/python
  1. For the first time it may complain about new host and so on. So don't worry.
  2. Add new run configuration with settings:
  • Host: 0.0.0.0
  • Port: 8080
  • Environment variables: DJANGO_SETTINGS_MODULE=myapp.settings
  • Working directory: /app
  • Path mappings: your absolute path to project direcory=/app
  1. Hit run button! You should get fresh running Django app.
  2. Now set breakpoint in setting file and start debug.
  3. Voilà!

debugging-dockerized-python-app's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

qubemudita

debugging-dockerized-python-app's Issues

[Question]

I really really liked your approached using ssh for debugging / running tests in pycharm.
I followed this approach but yet I did not figure out how to configure manage.py to the docker container in Pycharm.
In my setup I made a proxy .sh script for that purpose.
Do you have any idea how this could work in pycharm?

Thanks a lot
Best

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.