How do I debug properly using Eclipse and Pydev?

后端 未结 4 1508
攒了一身酷
攒了一身酷 2021-02-13 15:23

I have got Pydev configured properly so it runs my app, however when I want to inspect/trace my code by setting up breakpoints the debugger does not kick in (can\'t trace). Does

相关标签:
4条回答
  • 2021-02-13 15:39

    --noreload option is crucial, otherwise server will fork and your breakpoint won't trigger.

    0 讨论(0)
  • 2021-02-13 15:52

    Ordinarily you wouldn't have to select manage.py and hit debug. From your description it sounds like you may not have set up the Django launch params in the Run/Debug settings panel.

    Here are some step by step instructions:

    http://pydev.blogspot.com/2006/09/configuring-pydev-to-work-with-django.html

    and

    http://developeradventures.blogspot.com/2008/03/eclipse-django-debugging.html

    The important part is adding the entry to the Run/Debug settings. When it's time to debug, set the breakpoint, on the Eclipse toolbar click on the Debug button's drop-down arrow and select the Django project you've defined. Then from a browser window go to your Django server's URL. Eclipse should stop at the breakpoint.

    0 讨论(0)
  • 2021-02-13 15:55

    If you're debugging the Django runserver, make certain you specify the --noreload command line parameter. Otherwise the debugger ends up looking at the wrong python instance and never trips any breakpoints.

    0 讨论(0)
  • 2021-02-13 15:56

    Ok I think I found what my problem was. I had to set the breakpoint on the def statement in views.py instead of the statements after it.

    0 讨论(0)
提交回复
热议问题