How to debug flask in docker with intellij on Linux

Reference: https://blog.jetbrains.com/pycharm/2017/03/docker-compose-getting-flask-up-and-running/

Project to use in this page : https://github.com/wikimedia/analytics-quarry-web

Clone it https://gerrit.wikimedia.org/r/admin/repos/analytics/quarry/web

git clone "ssh://jiyu@gerrit.wikimedia.org:29418/analytics/quarry/web" && scp -p -P 29418 jiyu@gerrit.wikimedia.org:hooks/commit-msg "web/.git/hooks/"

Set up git-review

git review -s --verbose

I use intellij but PyCharm should be more or less the same.

Make sure your docker is configured correctly: https://docs.docker.com/engine/install/linux-postinstall/

Add remote interpreter

First let’s run by default to make sure it’s working. docker-compose build && docker-compose up

Notice I changed the file name from quarry.wsgi to wsgi.py Comment it out in dockerfile

Run docker-compose build again.

Run debugger in intellij, hit debugger!