Reputation: 2088
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:
Upvotes: 3
Views: 668
Reputation: 2088
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)
Upvotes: 3