-2

I'm getting this error every time I type python manage.py runserver in the root server of my Django app.

ImportError: No module named utils

I just added a new app to my project called 'utils' by running python manage.py startapp utils in the root directory of my project (/ecomstore/), and then moved it to the directory my book said to put it in.

Here's an overview of my project's directories, followed by my code:

ecomstore/

init.py

manage.py

settings.py

urls.py

views.py

wsgi.py

catalog.py/

init.py

admin.py

forms.py

models.py

tests.py

urls.py

views.py

static.py/

catalog.css

catalog.html

css.css

templates/

base.html

catalog/

catalog.html

index.html

tags/

utils/

init.py

models.py

tests.py

views.py

context_processors.py

The relevent code from my settings.py file is below:

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'catalog',
    'utils',
    # Uncomment the next line to enable the admin:
    'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
)

FWIW: I have also tried putting 'ecomstore.utils' under INSTALLED_APPS, and moving the utils directory to the root directory of my project. My book is called Beginning Django for Ecommerce and it's outdated. Thanks in advance for any help, I'm really stuck!

MikeBrody
  • 317
  • 3
  • 14
  • If you use `manage.py startapp ...` the directory should already be at the correct location. Why do you move it? – Matthias Oct 07 '13 at 05:00
  • My book told me to move it, and it also told me to write 'ecomstore.utils' instead of just 'utils'. It's from 2009 so I believe it's using deprecated techniques. – MikeBrody Oct 07 '13 at 05:52

1 Answers1

3
  • utils should be moved one level up, from "templates" to "ecomstore".
  • The init files should be named __init__.py, not init.py.
  • It is very unusual to have .py-endings for directories

I would strongly suggest to do teh django tutorial first if your book is outdated and after you succeed with this, try to adapt the book content to what you learned in the tutorial.

OBu
  • 4,977
  • 3
  • 29
  • 45
  • Thank you! I thought I tried every possible configuration but not that one. BTW __ init __.py (without spaces) was what I have, it just wouldn't enter properly in StackOverflow, and I made typos when I said .py for some directories, sorry. Thanks again! – MikeBrody Oct 07 '13 at 05:49