Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse/PyDev + Django debug

Eclipse/PyDev, Python 2.6, Django 1.1

All is working in run mode. If I put debug point inside manage.py file, breakpoint worked. But when I putted it in any action method, it causes nothing :(

like image 596
Igor Golodnitsky Avatar asked Dec 30 '22 23:12

Igor Golodnitsky


1 Answers

Usually the problem is that you're running with auto-reload in django, in which case a different process is actually feeding the pages, so, you need to run it with the no reload option or use the remote debugger.

(To configure PyDev to work with Django see: http://pydev.org/manual_adv_django.html)

Note that if you want to execute without the auto-reload feature (which PyDev should do automatically when you create a new Django run), you can do all directly (i.e.: the debugger and launching don't need any special adjustments).


Note: the situation has improved a bit recently, so, although the above answer is still valid, there are improvements for those that do want to develop with auto-reload on:


Answer with auto-reload on:

If you want to have auto-reload on while developing, use the tips at: PyDev and Django: how to restart dev server? (to overcome an issue where Django will leave child processes alive when the main process is killed)

And see the session related to the remote debugger at: http://pydev.org/manual_adv_remote_debugger.html to see how to attach the debugger to PyDev when using the auto-reload feature (mainly, you'll need to start the remote debugger, but will add breakpoints regularly and PyDev will stop on those provided you call pydevd.patch_django_autoreload() before you main session -- i.e.: before if __name__ == "__main__":, add the following: import pydevd;pydevd.patch_django_autoreload()).

like image 165
Fabio Zadrozny Avatar answered Jan 06 '23 12:01

Fabio Zadrozny