I am using the Django framework for my Python web application using the Eclipse IDE and PyDev plugin. How to use debugging features?
UPDATES1 especially using the http://pydev.org/updates plugin
UPDATES2 I have already done the following:
.pydevproject
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?eclipse-pydev version="1.0"?> <pydev_project> <pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Python25 </pydev_property> <pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.5 </pydev_property> <pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH"> <path>/pi-proto</path> </pydev_pathproperty> <pydev_pathproperty name="org.python.pydev.PROJECT_EXTERNAL_SOURCE_PATH"> <path>C:\Program Files\GeoDjango\Django-1.0.2-final</path> <path>C:\eclipse-SDK-3.7-win32\plugins\org.python.pydev.debug_2.2.3.2011100616\pysrc </path> </pydev_pathproperty> </pydev_project>
manage.py
#!/usr/bin/env python from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it causing an ImportError somehow.)\n" % __file__) sys.exit(1) if __name__ == "__main__": import sys if len(sys.argv) > 1: command = sys.argv[1] if settings.DEBUG and (command == "runserver" or command == "testserver"): # Make pydev debugger works for auto reload. try: import pydevd except ImportError: sys.stderr.write("Error: " + "You must add org.python.pydev.debug.pysrc to your PYTHONPATH.") sys.exit(1) from django.utils import autoreload m = autoreload.main def main(main_func, args=None, kwargs=None): import os if os.environ.get("RUN_MAIN") == "true": def pydevdDecorator(func): def wrap(*args, **kws): pydevd.settrace(suspend=False) return func(*args, **kws) return wrap main_func = pydevdDecorator(main_func) return m(main_func, args, kwargs) autoreload.main = main execute_manager(settings)
Run Configurations - Arguments
runserver 0.0.0.0:8001
UPDATES3 I follow this link http://bear330.wordpress.com/2007/10/30/how-to-debug-django-web-application-with-autoreload/
But no success. Would you advise me how to properly follow the link above. Then I will update the result here.
UPDATES4 I am using Python 2.5.2, GeoDjango 1.2.7, Eclipse Indigo with the PyDev plugin.
source share