Setting up Django in Eclipse Pydev

Hi Folks,

I am desperate and hope someone can help.

For days a try to get my Django running in pydev. I have installed everything (it seems to me) correctly. But when I try to create a new Django Project as soon as I click “Next” I get an error message telling

“*Django not found” To get started with Django in Pydev, a pre-requisite is that Django ist installed in the Python / Jython / IronPython Interpreter you want to use (so “Import Django” must properly work).

It seems that the selected Interpreter does not have Django available, so, please install Django, reconfigure the Interpreter so that Django is recongnized and Then come back to the wizard."

I was able to create a Project via CMD manually just by entering “django-admin startproject demo” but it does not work via the wizard in Eclipse.

For some reason it worked before but I was getting errors when typing code, but now it is not working any more at all. Did I set up sth. wrongly with the Interpreter?!

Would be awesome to get some hint frome anyone!! Thanks a lot in advance.

Summary

Which interpreter do you have configured to use with this project? That interpreter has to have Django installed in site-packages. Whether that interpreter is created by the OS, by a built version, or a virtual enviroment won’t matter.

One thing to try is to create a virtual enviroment, pip install Django with that enviroment active, and select that is the active interpreter. Then try it again.

-Jorge

(Speaking as someone who has used Eclipse / PyDev from the very beginning: Pick another option. For the sake of your sanity, use something else. Use anything else.)

Now, having said that, what you’ll want to do is ensure that you have a fully functional virtual environment set up and working. First test it outside of Eclipse to prove to yourself that it works.

Once you’ve done that, then in Eclipse, you’ll want to go to Windows / Preferences / PyDev / Interpreters / Python Interpreter. On the top half you’ll select “New…” to select the python executable that resides within the virtual environment that you want to use. (This is basically what’s documented in the link in the dialog box you’ve posted.)

After you’ve done this, you need to select “Apply” at the bottom to make it read the contents of that environment to know what packages are installed.

Keep in mind that every time you make a change to that virtual environment, you need to go to this settings dialog box and select the “Apply” button at the bottom to make Eclipse rescan your library directories to see what packages are installed. If you had previously set up your interpreter, and then later installed Django, you could get this message due to Eclipse not seeing that this package has been installed.

Ken

1 Like

Hi guys!
Thanks a lot for your quick help!!
Actually it already helped!
What I did was just remove the interpreter under preferences->python interpreters closed it and added it once again and guess what, it worked! :slight_smile:
Actually what I still have to do is to add a virutal environment… Have to find this out…
Great. Thanks a lot!