Question

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 :(

Was it helpful?

Solution

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()).

OTHER TIPS

also if while attempting to import pydevd eclipse can't find the pydevd depependency. Make sure to add it from your plugins folder:

  • Look for your eclipse/plugins/org.python.pydev_x.x.x/pysrc where x.x.x is your eclipse pydev plugin version. In the eclipse/plugins folder you will find lot's of folders that start with a similar name only one of them will have a pysrc subfolder(and the right version number).
  • Add eclipse/plugins/org.python.pydev_x.x.x/pysrc to your project's external libraries:
    • Right click on your project explorer.
    • Go to properties/PyDev - PYTHONPATH/External Libraries/ and click on Add Source folder.
    • Find your eclipse/plugins/org.python.pydev_x.x.x/pysrc folder on the provided browser.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top