Django非常新,所以請耐心等待。以下是Django民意調查項目,使用Django Book的課程(發佈者,作者,書籍)。我一直堅持在shell中導入我的模型。from appname.models import出版者,作者,書
的應用程序名稱是通用和項目名稱是mysite的
錯誤:
>>> from General.models import Publisher, Author, Book
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
from General.models import Publisher, Author, Book
ImportError: No module named General.models
>>>
我的文件夾:
C:\
BookShelf/
sqlite3.db
mysite/
mysite
media
manage.py
General/
_init_.py
_init_.pyc
models.py
models.pyc
tests.py
views.py
如果這能幫助:
>>> import sys
>>> print sys.path
['', 'C:\\Python27\\Lib\\idlelib', 'C:\\Python27\\Lib', 'C:\\Python27\\DLLs', 'C
:\\Python27\\Lib\\lib-tk', 'C:\\BookShelf\\mysite\\General\\models.py', 'C:\\WIN
DOWS\\system32\\python27.zip', 'C:\\Python27\\"C:\\BookShelf\\mysite\\General\\m
odels.py"', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27', 'C:\\Python27\\lib\\s
ite-packages', 'C:\\Python27\\lib\\site-packages\\PIL']
>>>
我試過'從我的site.General.models'也沒有成功。
在此先感謝!
其中是你的settings.py? – catherine 2013-03-21 03:31:15