OK, I have the following directory structure (this is a django project):
-> project
-> app
and in the application folder there is a scraper.py file, which should refer to the class defined in models.py
I am 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 doesn't work. I get an error message:
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 was used, but it broke somewhere along the line, and I am very confused why I have problems. On SnowLeopard using python2.5.
source
share