Django debugging with Emacs

前端 未结 6 914
小鲜肉
小鲜肉 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:20

    Because recent versions of Emacs python mode do support 'pdbtrack' functionality by default, all you need is just set up breakpoint in your code this way:

    import pdb; pdb.set_trace()
    

    Also, you have to start your Django application devserver from within Emacs shell:

    M-x shell

    And then, in the shell, start the Django development server:

    python ./manage.py runserver
    

    P.S. No need for specific pdb sessions or --noreload flag. Noreload would require you to manually restart your applications and so I do not find this useful for Emacs.

提交回复
热议问题