I do in model:

usually "99_fixtures.py"
<code>

my_dict_with_values = dict(field='value',anotherfield='anothervalue')

if db(db.table).count() == 0:
    db.table.insert(**my_dict_with_values)

</code>





2010/12/7 Robert <zater...@gmail.com>

> I recently deployed an web2py application on GAE.  The datastore was
> empty at that point, and I couldn't add data through the Datastore
> Viewer since the tables/entities were not created yet.
>
> I now solved this by creating a form in web2py where I can manually
> populate the database with the initial data my application needs. From
> that point on I could use the Datastore Viewer to further edit/setup
> my data.
>
> So I am wondering what is the best way to populate the initial
> database automatically? Is there a way to define that data in the
> web2py db DAL definition as well? Or is there a specific GAE deploy
> feature for this I am missing?
>
> Thanks in advance!




-- 

Bruno Rocha
http://about.me/rochacbruno/bio

Reply via email to