I'm new to Django. Now I'm learning Django, using Writing your first Django app<https://docs.djangoproject.com/en/dev/intro/tutorial01/> (version 1.5.2) tutorial. I'm a *Windows 7 * and *Sublime Text 2* user.
Following this tutorial, I created a project called *newweb* in*C:\DjangoProjects *. And then in the *newweb* project I created an app called *polls*. So, now I have the following directory structure: newweb/ manage.py newweb/ __init__.py settings.py urls.py wsgi.py polls/ __init.py__ admin.py models.py tests.py - In the *models.py* file I have the following code: from django.db import models class Poll(models.Model): question = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') class Choice(models.Model): poll = models.ForeignKey(Poll) choice_text = models.CharField(max_length=200) votes = models.IntegerField(default=0) - When I build this code in Sublime Text 2 I get this error message: Traceback (most recent call last): File "C:\DjangoProjects\newweb\polls\models.py", line 3, in <module> class Poll(models.Model): File "C:\python27\lib\site-packages\django\db\models\base.py", line 93, in __new__ kwargs = {"app_label": model_module.__name__.split('.')[-2]} IndexError: list index out of range - What to do? I have read that to prevent this problem I have to add a *meta* class to each of my classes (*and it works for me*). *But *in the Django documentation I read the following: If a model exists *outside* of the standard locations (models.py or a models package in an app), the model must define which app it is part of. And this is *not my case*. So what's wrong with that? It must work well without *meta* classes. CONFIGURATION - I have added the *polls* app to* INSTALLED_APPS* in the *settings.py*file. - I synced the database (sqlite3), using *manage.py syncdb* - And what I have on my *PYTHONPATH*: [' ', 'C:\\python27\\lib\\site-packages\\distribute-0.6.49-py2.7.egg', 'C:\\python27\\lib\\site-packages\\pip-1.4.1-py2.7.egg', 'C:\\DjangoProjects\\newweb', 'C:\\Windows\\system32\\python27.zip', 'C:\\python27\\DLLs', 'C:\\python27\\lib', 'C:\\python27\\lib\\plat-win', 'C:\\python27\\lib\\lib-tk', 'C:\\python27', 'C:\\python27\\lib\\site-packages'] Also, I will say anything you ask. Thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.