I have a Django project in Eclipse PyDev.
I have a views.py file that has a line:
from models import ingredient2
In models.py, I have:
from django.db import models
class ingredient2(models.Model):
ingredient = models.CharField(max_length=200)
When I try to run the application, I get the following error:
File "C:\Python27\lib\site-packages\django\db\models\base.py", line 54, in __new__
kwargs = {"app_label": model_module.__name__.split('.')[-2]}
IndexError: list index out of range
I synchronized the database and started the server.
I went to base.py and added 2 print statements (yes, I probably shouldn't edit the Django files):
if getattr(meta, 'app_label', None) is None:
model_module = sys.modules[new_class.__module__]
print model_module
print model_module.__name__
kwargs = {"app_label": model_module.__name__.split('.')[-2]}
They print:
<module 'models' from 'C:\Users\Tine\workspace\slangen\slangen2\bolig\models.pyc'>
models
manage.py is located in the Bolig folder. I think the correct application shortcut will be "bolig". The application worked a few months ago, and now, when I return to it, something is wrong. I am creating other projects in PyDev.
source
share