Python bottle: iterate through folder in app's route or in template?
In general, a best practice is to do the work in the app, and do (only) presentation in the template.  This keeps your so-called business logic as separate as possible from your rendering.
Even if it wasn't a bad idea, I don't even know how you could walk through a directory of files from within a template.  The subset of Python that's available to you in a template is pretty constrained.

Hope that helps!
I'm beginning to work on a Python 3.4 app to serve a little website (mostly media galleries) with the bottle framework. I'm using bottle's 'simple template engine'
I have a YAML file pointing to a folder which contains images and other YAML files (with metadata for videos).
The app or the template should then grab all the files and treat them according to their type.
I'm now on the point where I have to decide whether I should iterate through the folder within the app (in the function behind the @app.routedecorator) or in the template.
Is there a difference in performance / caching between these two approaches?
Where should I place my iteration loops for the best performance and the most "pythonic" way?