I'm new to Python but am a long time user of IntelliJ IDEA for Java, so I've been trying to get started using the Python plugin. I am running a Django app in a locally hosted VM, and I'm trying to remote debug it from my MacBook Pro. I have tried both with IDEA and PyCharm and I get the same behavior: my app freezes upon executing the 'setTrace' call and never returns. I have to send it a control-C to kill it.
According to this Stack Overflow answer, it doesn't work to call setTrace from Django until everything is done:http://stackoverflow.com/questions/6989965/how-do-i-start-up-remote-debugging-with-pycharm
So I added these lines to the bottom of my manage.py file:
pydevd.settrace('188.8.131.52', port=8005, stdoutToServer=True, stderrToServer=True)
print "Finished setting debugger"
I find that I have to hit control-C to get PyCharm to enter the debugger, but when I hit play to restart I find that Django has stopped responding to web requests. If I move the lines of code earlier I don't have to hit control-C, but I still find that Django stops responding once I resume.
Can you offer any help in debugging this problem. Is this something that I've misconfigured, or does it represent a problem with the PyCharm plugin?
P.S. Here's a stack trace I get after killing the process. It seems to be stuck in _locaked_settrace, but I don't know why.
Setting up IntelliJ debugging
C-c C-c^CTraceback (most recent call last):
File "./manage.py", line 97, in <module>
startup = importlib.import_module(edx_args.startup)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
File "/edx/app/edxapp/edx-platform/cms/startup.py", line 8, in <module>
settings.INSTALLED_APPS # pylint: disable=W0104
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
self._wrapped = Settings(settings_module)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/conf/__init__.py", line 93, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
File "/edx/app/edxapp/edx-platform/cms/envs/devstack.py", line 61, in <module>
from .private import * # pylint: disable=F0401
File "/edx/app/edxapp/edx-platform/cms/envs/private.py", line 6, in <module>
pydevd.settrace('184.108.40.206', port=8005, suspend=False)
File "/edx/app/edxapp/edx-platform/pycharm-debug.egg/pydevd.py", line 1230, in settrace
File "/edx/app/edxapp/edx-platform/pycharm-debug.egg/pydevd.py", line 1279, in _locked_settrace
C-c C-z^Z Killed ./manage.py cms runserver –settings=devstack 0.0.0.0:8001