I'm using Pyramid and I test my web app using web server that comes with Paste package (script to start web server is called 'paster').
I placed pydevd.settrace() call in middleware.py file in the global scope (after imports) but this did not work as execution has stuck in this line. Moving pydevd.settrace() call to make_app() function solved the problem.
I think other users of PyCharm might be struggling with the right placement of pydevd.settrace() call as well. It would be very helpful if PyCharm could provide information on the right place to put pydevd.settrace() call in popular Python web frameworks/web servers.