Wow this is the coolest thing...thnx

On Tuesday, 16 September 2008 07:20:24 UTC+5:30, Steve Holden wrote:
>
> Mathieu Leplatre wrote:
> > Hi all,
> >
> > I found many post about specific errors regarding django as a
> > standalone tool.
> >
> > With a little bit of researching, I ended up with this script below.
> > Unfortunately, it fails on database initialization.
> >
> > ...
> > ...
> >  File "/home/mathieu/Code/uhm/svn/uhm/django/db/backends/sqlite3/
> > base.py", line 167, in execute
> >    return Database.Cursor.execute(self, query, params)
> >    sqlite3.OperationalError: no such table: polls_poll
> >
> > The sqlite file is empty (0 byte). How can I syncdb programatically
> > (and only once) ?
> >
> > Thanks !
> >
> >
> > import datetime
> > from django.conf import settings
> > settings.configure( DATABASE_ENGINE = "sqlite3",
> >                             DATABASE_NAME   = "./polls.db",
> >                             INSTALLED_APPS = ('polls'))
> > from django.db import models
> >
> > class Poll(models.Model):
> >     question = models.CharField(max_length=200)
> >     pub_date = models.DateTimeField('date published')
> >     class Meta:
> >         app_label = "polls"
> >
> > p = Poll(question="What's up?", pub_date=datetime.datetime.now())
> > p.save()
> >   
> This is k=nd of a wild-assed guess. Please tell me if it works.
>
> from django.core.management import call_command
> call_command('syncdb')
>
> regards
>  Steve
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/DNWaqBp35PsJ.
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.

Reply via email to