tags:

views:

6357

answers:

8

Hi,

I have updated to latest Django version 1.0.2 after uninstalling my old Django version.But now when I run django-admin.py I get the following error. How can I resolve this?

Traceback (most recent call last):
  File "C:\Python25\Lib\site-packages\django\bin\django-admin.py", line 2, in <module>
    from django.core import management
ImportError: No module named django.core
+4  A: 

You must make sure that django is in your PYTHONPATH.

To test, just do a import django from a python shell. There should be no output:

ActivePython 2.5.1.1 (ActiveState Software Inc.) based on
Python 2.5.1 (r251:54863, May  1 2007, 17:47:05) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>>

If you installed django via setuptools (easy_install, or with the setup.py included with django), then check in your site-packages if the .pth file (easy-install.pth, django.pth, ...) point to the correct folder.

HIH.

Fil
if u read the comments on his question, he already tried import djago and it works.
hasen j
@hasen he probably had django in his local app folder, but did not have django in his pythonpath.
apphacker
+1  A: 

I'm sure it's related to something incorrect in my setup, but I am having the same problem, and it works properly if I call it thusly

c:\somedir>python c:\Python26\scripts\django-admin.py startproject mysite
cmsjr
A: 

As usual, an install script failed to set world read/execute permissions :) Do this:

sudo find  /usr/lib/python2.5/site-packages/django -type d -exec chmod go+rx {} \;
sudo find  /usr/lib/python2.5/site-packages/django -type f -exec chmod go+r {} \;
greg
i wonder if windows has sudo :D
Dmitry Shevchenko
A: 

You can get around this problem by providing the full path to your django-admin.py file

python c:\python25\scripts\django-admin.py startproject mysite
Niyaz
+4  A: 

I encountered this problem today, it turned out that I had C:\Python26 in my path and .py files were associated to Python 3.1. Repairing the proper version of Python, either through Programs and Features or by running the .msi, will fix the associations.

Steve McKay
A: 

This worked for me with bitnami djangostack:

python apps\django\django\bin\django-admin.py startproject mysite
Tod
A: 

If your path variables are correct and from the python shell you can do: from django.core import management , make sure you're including "python" before "django-admin.py" as such: python django-admin.py startproject thelittlethings

Mindspam
A: 

Thanks for posting the question and answers. I have two versions of Python installed, but root was pointing to the /usr/bin version, and I wanted to use the 2.7 version of Python in /usr/local/bin. After rebuilding/reinstalling Django and mysqldb, all is well and I'm not getting the error.

octopusgrabbus