Django debugging with Emacs

前端 未结 6 910
小鲜肉
小鲜肉 2021-01-30 02:59

I found a lot of info about how to debug simple Python programs with Emacs. But what if I want to debug a Django application? I run the development server and I would like to so

6条回答
  •  粉色の甜心
    2021-01-30 03:09

    Start pdb like this:

    M-x pdb

    Then, start the Django development server:

    python manage.py runserver --noreload
    

    Once you have the (Pdb) prompt, you need to do this:

    import sys
    sys.path.append('/path/to/directory/containing/views.py')
    

    Once you've done this, you should be able to set breakpoints normally. Just navigate to the line number you want, and

    C-x SPC

提交回复
热议问题