I'm not sure but maybe you need the INSTALLED_APPS setting.

On Aug 30, 10:21 am, ceeed <[EMAIL PROTECTED]> wrote:
> Hello,
> I am a Django newbie and trying to learn it.
>
> As a project, I am trying to use the Django ORM in a stand-alone sense
> (i.e., without creating a project and app). I am using SQLITE and have
> defined the models. I would like to a) create the table in the
> database based on my models, b) populate the table, and c) do queries.
>
> I am running into various problems. My models.py file looks like this:
>
> from django.db import models
> class Template(models.Model):
>     name = models.CharField("Name of template", max_length=30)
>     type = models.CharField("Type of template", max_length=10)
>     style = models.CharField("Style of template", max_length=10)
>     def __unicode__(self): return u'%s' % self.name
>
> My settings file looks like this
>
> DEBUG = True
> DATABASE_ENGINE = 'sqlite3'           # 'postgresql_psycopg2',
> 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
> DATABASE_NAME = '/Users/abhijit/moad.db'             # Or path to
> database file if using sqlite3.
> DATABASE_USER = ''             # Not used with sqlite3.
> DATABASE_PASSWORD = ''         # Not used with sqlite3.
> DATABASE_HOST = ''             # Set to empty string for localhost.
> Not used with sqlite3.
> DATABASE_PORT = ''             # Set to empty string for default. Not
> used with sqlite3.
>
> I tried the following:
>
> abhijit$ python
> Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
> [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.>>> 
> import os
> >>> os.environ['DJANGO_SETTINGS_MODULE'] = 'moad_settings'
> >>> from django.db import models
> >>> from models import *
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "models.py", line 6, in <module>
>     class Template(models.Model):
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/db/models/base.py", line 51, in __new__
>     new_class._meta.app_label = model_module.__name__.split('.')[-2]
> IndexError: list index out of range
>
>
>
> Any help/pointers would be appreciated.
> Thanks,


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to