When in the python terminal within a subfolder of my project (the subfolder that contains both my settings.py and a models.py), I perform the following:
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
from models import *
I get the following error:
/usr/local/lib/python2.7/dist-packages/django/db/models/base.pyc in __new__(cls, name, bases, attrs)
90 # For 'django.contrib.sites.models', this would be 'sites'.
91 model_module = sys.modules[new_class.__module__]
---> 92 kwargs = {"app_label": model_module.__name__.split('.')[-2]}
93 else:
94 kwargs = {}
IndexError: list index out of range
This is the same error seen in Defining a model class in Django shell fails but here I have the models defined in a project. What is the problem?