>
> (1) unless one is dealing with a pretty basic db, almost inevitably one 
> starts including web2py specific pieces that make sharing considerably more 
> complicated than just "from gluon import DAL, Field" :(  In my case, 
> besides record versioning, validators etc.  there's a trivial example - I 
> specify the path to the uploads folder as relative to "request.folder"  :)
>

Yes. You either need to write all the model code so it is independent of 
the web2py environment from the beginning (e.g., put models in modules, 
explicitly import any web2py objects needed, and explicitly specify 
relevant filesystem paths, such as the uploads folder), or plan to run your 
external program in the web2py environment (via the mechanisms discussed). 
 

> (2) As you say, unless there really is a very strong argument for stepping 
> outside the web2py environment, it really is just easier (and probably more 
> future proof) to extend the app to include the formerly standalone 
> functions (in a much extended modules directory) or, perhaps a separate 
> web2py app e.g. where the db is shared but where the user populations are 
> different. btw, how DOES one best share models between two web2py apps
>

If you really need separate apps, the best way to share model code is to 
put it in modules and import (which means you'll need to wrap calls to 
db.define_table in functions or classes within those modules). An 
alternative is to use auto_import 
<http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Using-DAL-without-define-tables>,
 
though that only gets you very minimal table definitions (just the 
attributes needed by the database, such as column names and types).

You might still consider a single application, though -- there's no reason 
you can't have a separate interface for different groups of users. Also, if 
you don't want a web interface but are instead creating a CLI or desktop 
app, you can still interface with a running web2py app via HTTP requests or 
RPC calls -- see http://web2py.com/books/default/chapter/29/10/services for 
details.

Anthony

-- 
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.

Reply via email to