Karen, Yes have models in same directory as settings - bad girl!
Thanks. Phoebe. On Jan 26, 1:37 pm, Karen Tracey <kmtra...@gmail.com> wrote: > On Mon, Jan 26, 2009 at 8:03 AM, phoebebright > <phoebebright...@gmail.com>wrote: > > > > > > > Am I blind? > > > I am getting this error in the shell, but no obvious errors when using > > the browser interface. > > > >>> from models import Business > > Traceback (most recent call last): > > File "<console>", line 1, in ? > > File "/home/django/towns/models.py", line 8, in ? > > class Category(models.Model): > > File "/usr/lib/python2.4/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 > > Normally I'd expect "from models import Whatever" from manage.py shell to to > give me an "ImportError: No module named models". The fact that yours > doesn't implies you've either got a models.py file in the same directory as > your settings.py or you've put an individual app directory on your > PYTHONPATH. Neither seems like a particularly good idea. Instead use: > > >>> from appname.models import Business > > (where 'appname' is replaced with your actual app name) and then you won't > get an error when Django tries to figure out the app label associated with > the model. > > Karen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---