Friday, March 14, 2008

Eclipse Django Environment

I'm a newbie in Django and Eclipse with PyDev, have only used Eclipse very superficially with C/C++, which is still my favorite language. Still, as time goes on, more and more needs to be done in a way that will allow rapid development and ease of installation and maintenance. Here is where I meet Django, my new job requires me to be as efficient as can possibly be, thus using Eclipse is a good alternative, among various others that can be found on the net. I will not go into the details of installing neither Eclipse nor Django, this exercise only focuses and the issue of preparing the Eclipse platform to allow us to be more productive in the both programming and debugging this mature Web Framework.

I am using Eclipse 3.3 with CDT, JDT, and MyLynt development, we need the Python and XHTML support, for this we will add the Amateras HTML plugin and the PyDev module.
WARNING, my system currently uses Python 2.5 and I am using the Django 0.97 developing branch which better supports the newforms.:
After downloading, extract the compressed file to where ever you may want to, and copy to the Eclipse path. I am using Ubuntu 7.10 and what I did is manually install Eclipse in /opt/eclipse. Thus I copied the resulting files from Amateras and PyDev accordingly:

Amateras decompressed folder

cd /some/path/to/Amateras/decompressed/folder/eclipse

sudo cp -R plugins/* /opt/eclipse/plugins/

sudo cp -R features/* /opt/eclipse/features/

PyDev decompressed folder

cd /some/path/to/Pydev/decompressed/folder/plugins

sudo cp -R * /opt/eclipse/plugins/

Once the files have been copied, we need to configure the Eclipse, so it knows where the python executable lives as well as the django installation, for that we go to the main menu and Windows>Preferences>PyDev>Interpreter Python and we Add the location of the python executable, in my case: /usr/bin/python. Then we add the New Folder for the PYTHONPATH to Django: /usr/lib/python2.5/site-packages/django. Click Apply/OK and were done.

With this we are done setting up our development environment, hope this helps any one.

4 comments:

tommy tom said...

This really helped a lot! Eclipse is so open, maybe TOO open. Having a good idea of some useful and likable plugins for python and html dev really was a good push.

Thanks!

Francisco Benavides said...

I'm glad all this helped out! :)

Jason said...

Thank you for explaining how to easily add django to eclipse!
I'm just getting into programming and figure that python is great and flexible language for just about anything.
Thanks again from a true newb

明觉 said...

thanks, it's helpful