Version 31 (modified by 14 years ago) ( diff ) | ,
---|
Table of Contents
Developer Guidelines - Eclipse
Eclipse is a full IDE supporting Debugging & Code Completion.
PyDev is an Eclipse module which supports Python.
Installation
An Eclipse install with PyDev included is available in the 75Mb zip file which also includes Web2Py & Eden:
or install manually:
- Install Java JDK
- Install Eclipse (3.6 documented here)
- If using JDK 6u21: modify eclipse.ini
- Install PyDev through Eclipse:
- Help menu > Install New Software
- Work with: http://pydev.org/updates
- Add, OK
- tick PyDev (can exclude the optional PyDev Mylyn Integration), Next, Next, Accept, Finish
- tick to trust certificate, Restart now
- Set up the Python Interpreter:
- Window > Preferences > PyDev > Interpreter - Python
- New, Browse to python26/python.exe, OK, OK
- Add a new PyDev Project:
- File > New > Project > PyDev Project > Next
- untick Use Default
- Browse to the web2py directory
- Give the project a name: "web2py", Next
- untick "Create default 'src' folder and add it to the pythonpath"
- Debug Configuration: Run > Debug Configurations > Python Run
- Name: Sahana Eden
- Project: Browse to eden
- Main Module: Browse to web2py.py
- Arguments tab: Program Arguments: -a password
- Apply, Debug
- unblock in Windows Firewall
- If you want a HTML and JS editor (with syntax highlighting) in Eclipse:
- Help menu > Install New Software
- Work with: http://download.eclipse.org/releases/helios
- Add, OK
- Select
Web, XML and Java EE Development
- Select
Web Tool Platform
(?) - tick to trust certificate, Restart now
Other Installation Guides (should not be required):
- http://kollerie.wordpress.com/2009/04/07/setting-up-your-ide-for-web2py-development/
- (Simpler Instructions) http://allisterx.blogspot.com/2009/06/using-web2py-framework-on-eclipse.html
Bzr integration (optional)
- http://wiki.bazaar.canonical.com/BzrEclipse
bzr checkout --lightweight lp:bzr-xmloutput cd bzr-xmloutput python setup.py install cd ..
Configuration
- Right-click on Java perspective in top-right & select Close
- Window menu > Open Perspective > Other > Debug
- Window menu > Show View > Expressions
- right-click on toolbar > Customise Perspective > untick PyDev Debug, Run & External Tools
- Window menu > Preferences > General > Editors > File Associations > *.html
- Add (lower one), Text Editor, OK, Default, OK
- Windows > Preferences > General > Editors > Text Editors > tick Show line numbers
- Windows > Preferences > General > Workspace > tick 'Refresh automatically' (untick 'Build automatically')
Debugging with Eclipse
- Set and remove breakpoints by double clicking in the margin of the code file
- Click the 'Debug Sahana Eden' button
- F5 Step into functions
- F6 Step over lines
- F7 Step out of functions
- Use expressions (drag and drop from code) or right-click > watch
Accessing private data
Some data is marked as private to let other developers know they shouldn't access this directly
- e.g. in
s3xrc.py
we haveS3Resource.__set
&S3Resource.__query
This then means that Eclipse can't see these attributes as self.__set
, etc.
Instead need to use:
xxx._ClassName__AttributeName
e.g.:
resource._S3Resource__query resource._S3Resource__set
Related Links
Note:
See TracWiki
for help on using the wiki.