Re: Error: No module named books

433 views
Skip to first unread message

jianhui chen

unread,
Nov 29, 2012, 8:04:08 AM11/29/12
to django...@googlegroups.com
I am learning django book too. Do you check the output of error.? Generally, there are hint like ValueError in the output.

On Wednesday, November 28, 2012, Chris Recher wrote:
Hi all,

I'm working through the Django book and I've run into an error that wasn't predicted. I've got a project called mysite. I used "python manage.py startapp books" to create an app called books inside of it. I added a few models to the models.py file inside books, then tried to use "python manage.py validate". I got "Error: No module named books" in return. __init__.py is perfectly intact in both the second mysite directory and the books directory. I've added mysite.books to INSTALLED_APPS. All the results I could find searching for this problem deal with someone that's made a spelling mistake somewhere. I've been through my files multiple times, and my spelling is pristine. I figure I'm making an obvious, beginner's mistake - could anyone help?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/5gaeHt1dGtwJ.
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.

Tom Evans

unread,
Nov 29, 2012, 8:33:04 AM11/29/12
to django...@googlegroups.com
On Thu, Nov 29, 2012 at 4:51 AM, Chris Recher
<perfectlyge...@gmail.com> wrote:
> Hi all,
>
> I'm working through the Django book and I've run into an error that wasn't
> predicted. I've got a project called mysite. I used "python manage.py
> startapp books" to create an app called books inside of it. I added a few
> models to the models.py file inside books, then tried to use "python
> manage.py validate". I got "Error: No module named books" in return.
> __init__.py is perfectly intact in both the second mysite directory and the
> books directory. I've added mysite.books to INSTALLED_APPS. All the results
> I could find searching for this problem deal with someone that's made a
> spelling mistake somewhere. I've been through my files multiple times, and
> my spelling is pristine. I figure I'm making an obvious, beginner's mistake
> - could anyone help?
>

Hi Chris

First hint, newlines are free to use! Consider some next time!

Second, Django is an evolving framework. It helps to know what version
you are using.

Finally, launch the django shell ("python mange.py shell" instead of
"python manage.py runserver").
Try to import your module - "import mysite.books" - does it work?
If it doesn't, does this work? - "import books"

Cheers

Tom

Timothy Makobu

unread,
Nov 29, 2012, 11:40:28 AM11/29/12
to django...@googlegroups.com
Im betting you're using Django 1.4x 

The layout is different in 1.4. Download the version the book is using (1.1? https://www.djangoproject.com/download/ bottom right), then all should work.


--
You received this message because you are subscribed to the Google Groups "Django users" group.

Chris Recher

unread,
Nov 29, 2012, 9:24:36 PM11/29/12
to django...@googlegroups.com
Thanks for the help everyone. I was using 1.4.x, not the 1.0 the book is based on. After fooling around with the commands for a bit, I was able to figure out that the problem was in the INSTALLED_APPS section - I included 'mysite.books', but the new way to do that is just 'books'.
Reply all
Reply to author
Forward
0 new messages