Brand new to gud/pdb and I am trying to run the Django development server from emacs. I can't seem to set breakpoints that affect the running server, though.

I am invoking PDB with M-x pdb, then running it like python -m pdb manage.py runserver —noreload

Once gud-pdb buffer fires up, I can type c or r and the server starts up. I can access the server from a browser and server logs are output into gud-pdb buffer (At this point, I lose the (pdb) prompt, for what it’s worth.. until I kill the server). Here's what the output looks like:

Current directory is ~/dev/proj/                                                               
2  > /Users/ms/dev/proj/manage.py(3)<module>()                                                    
3  -> import os                                                                                  
4  Breakpoint 1 at /Users/ms/dev/proj/proj/app/models.py:393                                   
5  (Pdb) r                                                                                       
6  Performing system checks...                                                                   
8  System check identified no issues (0 silenced).                                               
9  January 05, 2018 - 13:55:24                                                                   
10 Django version 1.11.8, using settings 'proj.settings'                                          
11 Starting development server at                                         
12 Quit the server with CONTROL-C. 

I can visit files in my project and set breakpoints and they are logged in the gud-pdb buffer (at least until I start the server) but the breakpoint doesn’t seem to have an effect when I visit the view in question in the browser.

I've seen some indication this is possible in various forums but documentation on this use case is scant. I am running GNU Emacs 25.3.1 (x86_64-apple-darwin16.7.0) from Homebrew on a MacBook.

Any suggestions?

  • I would also be interested in knowing how to do this when containers are involved. – Oly Jan 30 '18 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.