ImportError and Django driving me crazy

Posted by John Peebles on Stack Overflow See other posts from Stack Overflow or by John Peebles
Published on 2010-04-04T20:58:34Z Indexed on 2010/04/04 21:03 UTC
Read the original article Hit count: 278

OK, I have the following directory structure (it's a django project):

-> project
--> app

and within the app folder, there is a scraper.py file which needs to reference a class defined within models.py

I'm trying to do the following:


import urllib2
import os
import sys
import time
import datetime
import re
import BeautifulSoup

sys.path.append('/home/userspace/Development/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings'

from project.app.models import ClassName

and this code just isn't working. I get an error of:

Traceback (most recent call last):
  File "scraper.py", line 14, in 
    from project.app.models import ClassName
ImportError: No module named project.app.models

This code above used to work, but broke somewhere along the line and I'm extremely confused as to why I'm having problems. On SnowLeopard using python2.5.

© Stack Overflow or respective owner

Related posts about django

Related posts about django-models