Stuck on Tutorial-- can't import Question

47 views
Skip to first unread message

Tim Fong

unread,
May 4, 2014, 7:30:37 PM5/4/14
to django...@googlegroups.com
Hi,
Here's my code:
from django.contrib import admin
# Register your models here
from django.contrib import admin
from polls.models import Question
admin.site.register(Question)

When I try to hit the admin page now, I get an error, 
"Exception Value:
cannot import name Question
Exception Location: /home/pi/mysite/polls/admin.py in <module>, line 5"

What am I doing wrong here?

Thanks 

Jorge Andrés Vergara Ebratt

unread,
May 4, 2014, 8:51:46 PM5/4/14
to django...@googlegroups.com

Check the models.py file, you might have a typo in Question

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/42d819a1-88f3-4e91-9259-075661f6e2bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alon Nisser

unread,
May 5, 2014, 10:11:48 AM5/5/14
to django...@googlegroups.com
Try to import Question from the shell.
python manage.py shell
>>from polls.models import Question
I guess you have a typo in the model that raises the import error. If it does import in shell then you have some other issue
Reply all
Reply to author
Forward
0 new messages