My last post was all about why I like using Eclipse for Django development. One of the comments left by Martin on that post had a request for a basic how-to on setting up a Django project in Eclipse with PyDev. I really did want to get this out a lot sooner but time did not allow for that.
First thing that you would need is to have your Django project ready. You can check one of my previous posts on how to get this done if you need to.
Setting up PyDev
Some settings need to be changed/updated to get going. Open Eclipse and click on “Window -> Preferences…” from the main menu. In the “Preferences” dialogue that opens, expand the “PyDev” node in the tree and select “Interpreter – Python” node. Next to “Python interpreters” click on the “New…” button and select the location where your Python is installed. Click on the “OK” button to close the “Preferences” dialogue.
Step 1 complete.
Creating the Project
In Eclipse, click on “File -> New -> Project…” in the main menu. A “New Project” dialogue window will come up. Select “Pydev Project” from the tree and then click on the “Next” button. In the “Project name” field on the next screen enter the name of the directory you used when creating your Django application (note that the Eclipse Workspace should be the parent directory of your project).
You should now notice that in the “Navigator” window in Eclipse should show all the files that were created in your Django project.
Step 2 complete.
Debugging
To be able to run and debug your Django project through Eclipse is pretty simple. In Eclipse, click on “Run -> Debug…” in the main menu which will then open the “Debug” dialogue window. In the tree double click on the “Python Run” node. Click on the “Browse…” button in the project section and select your Django project. Then click on the “Browse…” button under “Main Module” and select “manage.py”.
Now click on the “Arguments” tab and enter “runserver –noreload” in the “Program Arguments” field. Click the “Apply” button and you’re all done.
Step 3 complete.
All that’s left is to click on the “Debug” and you’re off. Happy debugging
Filed under: Development | Tagged: Development, Django, Eclipse, PyDev, Technology





[...] P3NK!N Django with PyDev « Now click on the “Arguments” tab and enter “runserver –noreload” in the “Program Arguments” field. Click the “Apply” button and you’re all done. All that’s left is to click on the “Debug” and you’re off. Happy debugging (tags: python django eclipse debugging ide debug) [...]
Thanks I was waiting for this one !
I think I will translate this one to french… even if it’s not that complex
How do you watch the object attributes in eclipse debugger? I set the break points, but nothing showing up in Variable window in debugger perspective.
All I get is:
Global:
error
error
Any suggestions?
When I start the dev server inside eclipse under debugger mode, it mention I am on PyDev Debugger.
So PyDev Debugger doesn’t support displaying object attributes in eclipse Variable window that is located at right top corner?
Hi Joe,
Apologies for the late reply. It does not seem to work properly with that yet but what does work for me is to highlight the variable that you want to inspect, right click on it and click on the Watch option from the pop-up menu.
That will open the Expressions window.
Hope that helps.
[...] Django with PyDev « P3NK!N – [...]
In arguements tab, one should also mention the base directory, which is actually the app directory.
For Debian or Ubuntu users, for which only an old and disfunctional version of pydev currently is available, simply install the available/prefered Eclipse, Python, Django and Pydev versions to meet all dependencies (you may have to use unstable repositiories if you cannot find Pydev in testing or stable).
Then get the latest Pydev release (a zip containing org.python.pydev.*, com.python.pydev.* folders) from pydev.org. Copy that stuff to the appropriate folders, where also the old, above installed version is located (/usr/lib/eclipse/features and /usr/lib/eclipse/plugins). It should be obvious what belongs where.
Restart Eclipse and the World should be perfect again.
Hi Penkin. Good post!! I have my eclipse with the python debugger correctly installed
I’m just to start the translation to spanish of the post to write it in my blog. The first thing inside it will be the link to here and the credits, of course.
Regards!!