Thursday, May 5, 2011

TG2.1 + Eclipse + Pydev

Here's how you do it.

create launch_tg.py, in the same directory as development.ini, contains:
#################################
from paste.script.serve import ServeCommand
ServeCommand("serve").run(["development.ini"])
#################################

Start Eclipse.
File -> New -> Project -> Pydev -> Pydev Project
Project name: test
Click: "Please configure an interpreter in the related preferences before proceeding."
New -> Browse -> /your_virtualenv_dir/your_webapp_dir/bin/python -> Ok -> Ok
Ok -> Finish

Pydev Package Explorer -> right-click on 'test' -> Refresh
Run -> Debug Configurations -> Python Run (double click)
Main tab -> Project -> test
Main tab -> Main module -> ${workspace_loc:your_eclipse_project/src/your_webapp_dir/launch_tg.py}
Arguments tab -> Working directory -> ${workspace_loc:test/src/Test}
Click debug


Taken from: http://ping.fm/DnR7T

4 comments:

  1. Hi Murzal,

    I have set up PyDev to work with tg2, but I can't get code completion to work in some cases. For example, in my setup, the request object has no code-completion, which is a real pity, as it's being used so much. You have code completion working for request objects? If so, any hints on how to get it working.

    thanks
    -Dave.

    ReplyDelete
  2. @Dave: Well, I faced similar issue. I had to manually add all TG2.1 packages in PyDev - PYTHONPATH. Terrible. If you found a simpler way to do it, please let me know.

    ReplyDelete
  3. I was finally able to get the debugger working, thanks!

    ReplyDelete