+1

On Dec 8, 7:50 pm, Bruno Rocha <[email protected]> wrote:
> I always use:
>
> if request.env.server_name=='rochacbruno.local' or
> request.env.http_host.split(':')[0]=='127.0.0.1':
>     db=DAL(<mylocaldb>)
> else:
>     db=DAL(<myproductiondb>)
>
> This is useful because I transfer my files by sftp or ssh, and I dont need
> to change the db everytime.
>
> 2010/12/8 mdipierro <[email protected]>
>
>
>
> > If you just have
>
> > production=True
> > if production:
> >   db=DAL('sqlite://production.sqlite')
> > else:
> >   db=DAL('sqlite://test.sqlite')
>
> > when you switch to production=False, it will recreate the missing
> > tables in test.sqlite.
>
> > On Dec 8, 8:10 am, Vidul <[email protected]> wrote:
> > > I'd like to create a testing database which contains the same tables
> > > as the production one.
> > > This is the code I came up with:
>
> > > for i in db_test.tables:
> > >     db_test[i].drop()
> > > db_test.commit()
>
> > > for i in db.tables:
> > >     db_test.define_table(i, db[i])
> > > db_test.commit()
>
> > > Is there a better way?
>
> > > Thank you for the help.
>
> --
>
> Bruno Rochahttp://about.me/rochacbruno/bio

Reply via email to