Setting up Django with Eclipse - “Django not found”

China☆狼群 提交于 2019-11-28 08:40:35

问题


I'm trying to setup Django with Eclipse. Right now I'm creating a new Pydev Django project, and getting "Django not found" error message.

When I try to verify Django is integrated via the command line, it works.

>>> import django
>>> print django.get_version()
1.2.5

I have exactly two python installations, 2.7 and 3.2, and I'm sure I'm using 2.7 from Eclipse (and the command line). What am I doing wrong?


回答1:


If you added the python interpreter before installing django, you can get this error message. Remove the python interpreter from eclipse and add it again. Eclipse will do some caching/searching of some sort. This solved my same problem.




回答2:


In my case I use virtualenv and a custom local version of easy_install to avoid needing to be root. I have Django installed in ~/.local/lib/python2.7/site-packages/. I added this path in Eclipse in the PyDev interpreter.

However, this did not fix the problem. It turned out that I needed to explicitly add the Django directory as well (ie: ~/.local/lib/python2.7/site-packages/Django-1.6.2-py2.7.egg/).

So remember to explicitly select the Django directory in PyDev interpreter especially if you have stuff customized in some fashion.



来源:https://stackoverflow.com/questions/5066381/setting-up-django-with-eclipse-django-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!