Django setup on Win7 - can't import some things

49 views
Skip to first unread message

LostInTheTrees

unread,
Feb 13, 2012, 11:35:41 AM2/13/12
to Django users
I am trying to get started with Django and having some trouble. I'm
using Django 1.2 to reserve the ability to go to Google's app engine
if I want. I have python 2.7 installed and working on Win7. I
unstalled Django 1.2 using the install script and it copied Django
into the site-packages directory.

I have been working through the tutorial and am just about finished.
However, in the last step, the tutorial uses generic views. When I run
it, I get "cannot import name DetailView". The import command,
straight from the tutorial is "from django.views.generic import
DetailView, ListView".

Early on, I could not execute django-admin.py. I had already installed
PIL and I had read about *.pth files in .../site-packages/*. So I
created a file django.pth. In it I put the single line "django\bin".
After this, django-admin.py could be easily executed.

Do I have to add more lines to django.pth? Is there something else I
missed?

-Bob

Brett Epps

unread,
Feb 13, 2012, 12:12:01 PM2/13/12
to django...@googlegroups.com
Hi Bob,

It sounds like you're using the 1.3 or later version of the tutorial.
Class-based generic views were added in 1.3. Try this link for the
correct version:

https://docs.djangoproject.com/en/1.2/intro/tutorial01/

(Note the 1.2 in the URL.)

Hope that helps,

Brett

>--
>You received this message because you are subscribed to the Google Groups
>"Django users" group.
>To post to this group, send email to django...@googlegroups.com.
>To unsubscribe from this group, send email to
>django-users...@googlegroups.com.
>For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>

Bob Carlson

unread,
Feb 13, 2012, 12:46:42 PM2/13/12
to django...@googlegroups.com
I guess that's it. I was conscious of the different tutorial versions, but must
have gotten onto the wrong one at some point.

Cheers, Bob

Bob Carlson

unread,
Feb 13, 2012, 1:07:35 PM2/13/12
to django...@googlegroups.com
I'm now on the 1.2 tutorial, but a similar error message is coming up. The
urls.py file is

from django.conf.urls.defaults import *
from polls.models import Poll

info_dict = {
'queryset': Poll.objects.all(),
}

urlpatterns = patterns('',
(r'^$', 'django.views.generic.list_detail.object_list', info_dict),
....

The error message is
ViewDoesNotExist at /polls/
Could not import polls.views.django.views.generic.list_detail. Error was: No
module named django.views.generic.list_detail

List_detail is clearly there in the django/generic folder.

Cheers, Bob

-----Original Message-----
From: django...@googlegroups.com [mailto:django...@googlegroups.com] On
Behalf Of Brett Epps
Sent: Monday, February 13, 2012 10:12
To: django...@googlegroups.com
Subject: Re: Django setup on Win7 - can't import some things

Bill Freeman

unread,
Feb 13, 2012, 2:31:43 PM2/13/12
to django...@googlegroups.com
Are you sure that you don't have something like:

...
urlpatterns = patterns('polls.views',
...

instead of the empty string first argument to patterns that you show?

Bob Carlson

unread,
Feb 13, 2012, 4:05:19 PM2/13/12
to django...@googlegroups.com
Thanks. That cleared the View Does Not Exist error. It was left over from the a
previous state of the tutorial.
Reply all
Reply to author
Forward
0 new messages