Sure, it should be allowed, but nothing will be returned to the browser while you're waiting for the copy to happen. If the copy takes too long, the HTTP request may time out.
Anthony On Friday, May 9, 2014 4:17:05 PM UTC-4, aapaap wrote: > > thanks Anthony, > > Thought it was difficult to generate a scheduled task. But in > PythonAnyWhere it'standard available. So I'll go that way. > > Still wondering if it's allowed to copy the default web2py database in a > controler function ? > > cheers, > Stef > > On 09-05-14 0:02, Anthony wrote: > > You probably don't want a web request to potentially have to wait for a > database copy over the network before returning a result. It would probably > make more sense to set up a scheduled task to replicate the database once a > day. Or better yet, look into the replication options offered by your RDBMS > (e.g., http://www.postgresql.org/docs/9.3/static/high-availability.html). > > Anthony > > On Thursday, May 8, 2014 4:30:03 PM UTC-4, aapaap wrote: >> >> hello, >> >> I've a web2py site, which should run, more or less synchronized, (with >> the same data) on 2 different servers. >> >> The first one is filling the database. >> >> The second one should copy the db from the first one if the database was >> refreshed more than 24 hours ago. >> >> So the solution I've in mind is the following: >> - on the second system I keep the last refresh of the database in some >> extra table of this database (I can't find another "global" storage) >> - when a specific controler is requested on this second system, it >> checks if the database needs to be refreshed, downloads the database >> from the first server and copies this over it's own database. >> >> Is replacing the database allowed in a controler ? >> Are there better solutions ? >> >> thanks, >> Stef >> > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.