Adding Auto Complete to A Django-PyDev Project on Eclipse

Today i was trying to use eclipse 3.3 w/ pydev to develop an app with django, but i really couldn’t make the code-completion (the main reason (along with the debugger) i was using eclipse!).

The main thing problem was that i had to add ALL folders to the pydev project settings. And, i didn’t have time (and patience) to add one folder by one to the config screen, sooo, i created this script to do that for me:

#!/usr/bin/env python

import dircache, os

def listdr(_dir):
try:
dir_list  = dircache.listdir(os.path.realpath(_dir))
dir_list = [_dir + “/” + d for d in dir_list]
only_dirs = filter(lambda d: os.path.isdir(d), dir_list)

file = os.path.realpath(_dir)
print “<path>%s</path>” % file

for dir in dir_list:
listdr(dir)

except:
return

if __name__ == “__main__”:
listdr(“/usr/lib/python2.5/site-packages/django/”)

This script will show all folders under /usr/lib/python2.5/site-packages/django/ with that tags <path>, ready to add to the .pydevproject configuration file (that’s under your project file).

Advertisements
This entry was posted in technology and tagged , , , . Bookmark the permalink.

One Response to Adding Auto Complete to A Django-PyDev Project on Eclipse

  1. ovnicraft says:

    i added the output from script in my .pydevproject but i dont get autocompletion

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s