Question

I am playing with a simple project based on Django framework. My IDE is PyDev/Eclipse.

I cannot make code completion work for Django code, but it works fine for standard Python libraries. I tried to add Django dir (in my case C:\Program Files\Python26\Lib\site-packages\django) to PYTHONPATH both on PyDev level (Window->Preferences->PyDev->Interpreter - Python->libraries) and on a project level (Project->Properties->PyDev - PYTHONPATH) - no luck so far.

Can you please advise what I am missing here (preferably without installing PyDev extensions).

Was it helpful?

Solution

Ok I give it another try.

Eclipse in C:\test\eclipse

Python 2.6.2 in C:\test\python-2.6.2

Django 1.0.2 final in C:\test\python-2.6.2\Lib\site-packages -> only the actual django folder not the docs, example, and so on. I did this without running setup.py as descriped in the INSTALL file.

Added C:\test\python-2.6.2 and C:\test\python-2.6.2\Lib\site-packages to the PATH variable

As described here I set the Interpreter in Eclipse by Window > preferences > pydev > Interpreter > Python. This automatically included a whole bunch of things under System libs like (C:\test\python-2.6.2\;C:\test\python-2.6.2\DLLs;C:\test\python-2.6.2\lib\site-packages;....). A whole bunch of Forced Builtins are also found.

Then I made a new "Pydev Project" added a package and there a new module with a class and a module which imports the class and calls a function from it. During writing this pressed Crtl+Space several times, and builtins as well as the new stuff from my Module where shown by code completion.

OTHER TIPS

I suggest Configuring pydev to work with django and

Getting started Eclipse/Pyddev

In the latter one there is a section specifically for code completion which mentions a problem with firewall or shell timeout. And in another section he mentions problems when (as in your case) the eclipse installations has spaces in the filepath

I solved setting the PYTHONPATH too. In the pallet Projects, right-click on the project -> properties In the PYTHONPATH configuration you have to put the folder that contains your project as a external folder.

Exemple: /var/www/my_project PYTHONPATH=/var/www/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top