3

I'm making a flask webapp with docker, I'm looking for a way to enable pycharm debugging, so far I'm able to deploy the app using the in built docker, the app is automatically ran due to the dockerfile configs using supervisord

When I connect my remote interpretor I get the usual:

 * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 579-233-679

But the post I perform clearly isn't going to that interpretor as I've marked all of the routes to be break points, I'm still getting the original results from the webapp and none of the break points do anything.

I guess I'm asking:

  • Am I going about this the wrong way? (should I just use a VM, remote debug on that and then containerise the VM later on)
  • Is what I'm trying to do even possible?
  • Should I just manually debug everything instead if I use this method of development?

1 Answer 1

3

Update:

the way to correctly enable debug mode for docker is to create a docker-compose.yml, this tells pycharm what to do when you give it a docker-compose interpreter, that way you can hook onto a service, my yml looks like:

version: '3.0'

services:
  web:
    build: .
    command: python3 app/main.py
    volumes:
      - .:/app
    ports:
      - "80:80"
      - "22"

the yml file isn't generated, you make it yourself.

This enables the port that I've set flask to go to 80 and allows the debugger to connect using port 22,

I followed https://blog.jetbrains.com/pycharm/2017/03/docker-compose-getting-flask-up-and-running/ quite closely. (if anyone stumbles on to this and needs a hand then comment I'll see if I can help)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.