當我使用Django shell時,它顯示一個錯誤;這是錯誤:在Django shell中定義模型類失敗
>>> from django.db import models
>>> class Poll(models.Model):
... question = models.CharField(max_length=200)
... pub_date = models.DateTimeField('date published')
...
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "D:\Python25\lib\site-packages\django\db\models\base.py", line 51, in __new__
kwargs = {"app_label": model_module.__name__.split('.')[-2]}
IndexError: list index out of range
我該怎麼辦?
在以下討論的類似問題:http://stackoverflow.com/questions/2215403/exception-when-trying-to-install-django-treebeard-based-on-instructions – pyfunc 2010-12-07 22:00:30
嘗試在該位置打印model_module .__ name__ 。 – pyfunc 2010-12-07 22:01:10