How to configure code completion for Django-based projects in PyDev?

I play with a simple project based on the Django platform. My IDE is PyDev / Eclipse.

I can't do the work of completing the code for Django code, but it works great for standard Python libraries. I tried to add a Django dir (in my case C: \ Program Files \ Python26 \ Lib \ site-packages \ django) in PYTHONPATH both at the PyDev level (Window-> Preferences-> PyDev-> Interpreter - Python->) and at the project level (Project-> Properties-> PyDev - PYTHONPATH) - so far no luck.

Could you tell me what I am missing here (preferably without installing PyDev extensions).

+4
source share
3 answers

OK, I give him 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 documents, example, etc. I did this without running setup.py, as described 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 installed the interpreter in Eclipse by Window> Preferences> pydev> Interpreter> Python. This automatically included a whole bunch of things in 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; ....). Also found a whole piece of forced built-in objects.

Then I created a new β€œPydev project”, adding a package and a new module appeared with a class and a module that imports the class and calls a function from it. During recording, it pressed Crtl + Space several times, as well as built-in modules, as well as new material from my module, which shows the completion of the code.

+1
source

I suggest setting up pydev to work with django and

Getting started Eclipse / Pyddev

The latter has a section specifically for completing code that mentions a problem with a firewall or shell timeout. And in another section, he mentions problems when (as in your case) eclipse installations have spaces in the file path

0
source

I decided to install PYTHONPATH. In pallet projects, right-click the project β†’ properties In the PYTHONPATH configuration, you must place the folder containing your project as an external folder.

Exemple: / Var / WWW / my _project PYTHONPATH = / var / WWW /

0
source

Source: https://habr.com/ru/post/1286201/


All Articles