Running debugger with django development server and setting breakpoints

Hello,
I’m trying to use the debugger to run the django development server and inspect the code by setting some breakpoints.
The server seems to run correctly, but breakpoints in code are ignored.
I’ve set up the per-project debugger in the Project Preferences panel, like this:

  • in Languages > python I’ve set the Default Python Interpreter to my virtualenv python executable
  • in Debugging I’ve set the local “manage.py” as Script and “runserver” as Script arguments
  • in Environment I’ve set DJANGO_SETTINGS_MODULE and PYTHONPATH

Then I’ve inserted a breakpoint in the code, ran the debugger, loaded a page that would hit the breakpoint and, the page loads but nothing happens in the debugger. The breakpoint is bypassed. Am I doing anything wrong?

You need to use remote debugging with Django I believe, have a look at this archived forum thread:

https://community.activestate.com/forum-topic/debugging-django-apps

I see, thanks. I suppose this means you either have to manually insert in-code breakpoints, or manually stop/start the debugger after each code change.
Is there any plan for future improvement of this feature (I see the post is quite dated)?

You do not need to manually stop/start the debugger when remote debugging. Komodo continuously listens for debugging sessions and breaks when it comes across a breakpoint.

Of course we are always working on improving our software, but this seems to be working by design, it could do with better documentation which is being worked on.

Well, I meant, if you type something and save, the development server would normally reload by itself, allowing you to check your changes on the output. While, as stated in the older post, to make breakpoints work, you have to add –noreload --nothreading. That prevents the server from automatically reloading, therefore I guess you have to manually stop the debugger and restart it every time you do some code change. It would be handy if the debugger could work without the –noreload option :slight_smile:

I’m trying IDE 10, but I see the django debugger runs more or less the same way as in previous versions. I’m wondering if I’m doing something wrong, or you are really forced to run the server with --noreload --nothreading in order to make breakpoints work.
I have set manage.py in Script, runserver --noreload --nothreading in Script arguments. Though just --noreload seems necessary. Without, it bypasses all breakpoints.
However, with --noreload set, if you make a code change (say you add a variable) and reload the page, you won’t see change in the debugger as the django server is not automatically reloaded after you save.
Since I’m running exactly the same feature in another IDE without the ‘no reload’ option, I’d like to know if there is a way to make this work in Komodo IDE too.

We have not changed the debugger logic inbetween Komodo IDE 9 and Komodo IDE 10. What you did in 9 you will have to do in 10.

All right, the point was to understand how to properly run the python debugger for a django project, in order to have breakpoints work, I’m not sure I got the right hints in the previous posts.
I could not find anything about it in docs or help desk. I’ve found out it works only if you set the debugger to run the django development server with --noreload, but that makes debugging uncomfortable since you have to manually stop/restart the debugger after every code change, which takes some time. Apparently It does not work otherwise. Am I correct?

Sorry, I do not have enough experience with Django debugging to help :frowning: I can only point to what was discussed earlier in the thread, for whatever it’s worth.