On Sat, Oct 3, 2009 at 4:19 PM, Ken <[email protected]> wrote:
> I'm setting up my first Django and my first project on a Windows XP
> machine, following the Django tutorial part 1 (http://
> docs.djangoproject.com/en/dev/intro/tutorial01/#intro-tutorial01).
>
> I'm stuck at the point where it says to test the installation by
> starting the Django development server with the command: "python
> manage.py runserver".
>
> When I do that, I get the error:
>
> C:\django\portal>python manage.py runserver
> Traceback (most recent call last):
> File "manage.py", line 2, in ?
> from django.core.management import execute_manager
> File "C:\python24\Lib\site-packages\Django-1.1\django\core\management
> \__init__.py", line 3, in ?
> from optparse import OptionParser, NO_DEFAULT
> ImportError: No module named optparse
>
> There is no optparse.py within the Django installation (at C:
> \Python24\Lib\site-packages\Django-1.1\) but there is one in C:
> \Python24\Lib\.
>
> Why is the "import" is not finding it?
>
>
That would seem to be some problem with your Python installation. The Lib
directory ought to automatically be on the Python path when you run python.
You can check this by checking sys.path from a Python shell, for example:
D:\tmp>\bin\Python2.4.4\python.exe
Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', 'C:\\WINNT\\system32\\python24.zip', 'D:\\tmp',
'D:\\bin\\Python2.4.4\\DLLs', 'D:\\bin\\Python2.4.4\\lib',
'D:\\bin\\Python2.4.4\\lib\\plat-win', 'D:\\bin\\Python2.4.4\\lib\\lib-tk',
'D:\\bin\\Python2.4.4', 'D:\\bin\\Python2.4.4\\lib\\site-packages']
>>> from optparse import OptionParser, NO_DEFAULT
>>> NO_DEFAULT
('NO', 'DEFAULT')
>>>
But if it's not there I'm not sure how you'd fix it (nor, if it is there but
for some reason you still cannot import stuff that is located in it, would I
know how to fix that).
Is there some reason you are using Python 2.4? Django does work with it but
it is fairly old. Since there seems to be something off with the install
you have you might just try installing a more recent Python and see if
things improve.
Karen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---