django debugging

Mar 12, 2011 at 11:54 AM

First off, amazing work guys. I'm really loving this..

So, I started a simple django project, I can run the debugger (in the properties I set the startup file to manage.py and in the command line arguments to runserver), works very well but breakpoints aren't hit. Breakpoints in a vanilla 'Hello World' are hit no problem. Possibly expecting a lot at this stage, but thought I would report it and if you need any further info let me know.

System, VS 2010 Ultimate, Python 2.7, Django 1.3 RC 1.

Cheers,

Fergal

Coordinator
Mar 12, 2011 at 6:26 PM

Thanks for the report - you're not the only one having issues w/ breakpoints. I've opened a bug http://pytools.codeplex.com/workitem/25 and will look into it first thing after PyCon.

Mar 12, 2011 at 7:44 PM

Thanks Dinov..

Mar 5, 2012 at 5:41 PM

Hi Dinov,

I'm still seeing the behavior that Fergal was seeing in this post, so I suspect there is another issue than workitem 25 here. I'm using VS 2010 Ultimate, PTVS 1.1, Python 2.7, and Django 1.3.1. Like Fergal, vanilla Python debugging works great. Also, I noticed I can hit breakpoints in the manage.py file (which is the startup file I have set). However, I can't hit a breakpoint in any interesting functions such as my views that are called as a result of me going to http://localhost in a web browser.

Let me know if I can provide more information,

-Kevin

Mar 5, 2012 at 5:45 PM

Oh sorry, I just noticed another detail that might be relevant. When I try to stop debugging my Django project, the spawned Python.exe window does not close and Django continues to server web pages just fine. I don't see this behavior with a vanilla Python project (i.e., stopping the debugger kills python.exe normally).

 

-Kevin

Coordinator
Mar 5, 2012 at 5:50 PM

One reason this might not be working for you is because Django automatically spawns a 2nd python interpreter for running your code in by default - and we don't debug into spawned processes.  If you add --noreload to the manage.py command line options then everything will run in the same process.  Hopefully that's the issue and you'll be able to debug then.

Mar 5, 2012 at 8:32 PM

Thanks dinov, that's what I was missing. I set my script arguments to be "runserver --noreload" and it now works great!

-Kevin