开发者

Django trying to set up a project and find out which Django I have

I'm on a Mac OS X Snow Leopard with Python 2.6.5, I'm trying to get django working but I keep getting this error. Do I need to add it to the path? I'm not sure where django is installed is there any way that I can find it?

solidariti:~/home/solidariti  
→ python
Python 2.6.5 (r265:79063, Aug  8 2010, 21:45:26) 
[GCC 4.2.1 (Apple Inc. build 5659)] on darwin
Type "help", "copyright", "credits开发者_JS百科" or "license" for more information.
>>> import django
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named django
>>> django.VERSION


This shows that there's definitely no Django in your Python include path.

You can try searching for the directory using regular file searching tools.


Yeah, you need to add Django to your python path. I'm not sure where you have Django installed, but for what it's worth, I set things up so I don't have to remember. I use virtualenv and pip. Create a new virtualenv, workon that virtualenv, and then

pip install django

pip and virtualenv are great for juggling python requirements. Django projects often have pip requirements files too, so if some day you want to use some random Django project, you can get the dependencies set up nice and quickly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜