You can already has subfolders in the templates folder. When you specify a 
template file, you would specify the path relative to the templates folder.
You could also make a decorator at the app level that automatically finds 
the appropriate template based on the filename and the function name.
But I would leave this to the apps, not make it a policy.



On Saturday, 1 June 2019 08:31:34 UTC-7, 黄祥 wrote:
>
> is it possible to have flexible folders pattern for templates folders ?
> *e.g.*
> mkdir apps/_scaffold/controllers
> mkdir apps/_scaffold/models
> mv apps/_scaffold/controllers.py apps/_scaffold/controllers/default.py
> mv apps/_scaffold/models.py apps/_scaffold/models/db.py
>
> then adjust some file :
> *apps/_scaffold/__init__.py*
> from .controllers import default
> from .models import db
>
> *apps/_scaffold/common.py*
> from .models.db import db
>
> *apps/_scaffold/controllers/default.py*
> from ..common import db, session, T, cache, auth
>
> *apps/_scaffold/models/db.py*
> from .. import settings
>
> like example above the controllers and models is flexible that can be put 
> on root web apps directory as a file (controllers.py and models.py) or 
> under subfolder of webapps (controllers/default.py and models/db.py)
> hopefully it can be implement to templates folders too, because by any 
> chance people want to migrate from web2py to web3py, they can make the 
> folders structure intact, just modify some file to match the module file 
> location, like example above
>
> seen you've hardcoded it on *web3py/core.py* for templates
> path = os.path.join(app_folder, 'templates')
>
> perhaps can define it on web apps base like controllers, models or 
> translations
>
> best regards,
> stifan
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/80a6911e-e608-47b4-8134-fde4e59c7746%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to