Large Number of Models in Web2py

42 views
Skip to first unread message

Juslin Guo

unread,
Feb 12, 2014, 11:07:01 AM2/12/14
to web...@googlegroups.com
Hi All,
I new to Web2py, comtemplating shifting a 500 over tables PHP Application over... Do you all know where i can learn how to optimize Web2py for large number of models. Is there a way i could define them without having to repeat it, at the same time, not loading all the models.

[Sorry if i make many posts, they are not showing up on my list somehow after posting]


Vinicius Assef

unread,
Feb 14, 2014, 9:49:52 AM2/14/14
to web2py
You can use conditional models ou a model-less application, importing
the ones you want to use.
> --
> 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+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Anthony

unread,
Feb 14, 2014, 10:38:31 AM2/14/14
to web...@googlegroups.com
For conditional models, check out http://web2py.com/books/default/chapter/29/04/the-core#Workflow as well as response.models_to_run here. You can also define models within a function or class in a module and import from the module.

Anthony

Anthony

unread,
Feb 14, 2014, 10:40:03 AM2/14/14
to web...@googlegroups.com
Also, if you set DAL(..., lazy_tables=True), that will defer much of the model definition code until the first time the table is accessed within a given request. Though with 500 models, I would probably not rely on lazy_tables exclusively.

Anthony
Reply all
Reply to author
Forward
0 new messages