Saturday, April 25, 2015

Re: Concept of partial views to be resolved from other views or template tags

On Sat, Apr 25, 2015 at 3:11 AM, Stephan Herzog <sthzgvie@gmail.com> wrote:
> I like that approach because it leads to any partial being a separated piece
> of logic that can be tested and developed on a dedicated url. If necessary
> it can be wrapped in a templatetag, which makes it easy to use from the
> template layer.


you might be interested in ESI (edge side includes, (partially)
implemented by Varnish [1]) or SSI (Serve Side Includes, as done by
Nginx [2]). they allow you to describe the 'assembly' of HTML in the
front end, using several fragments retrieved from the backside server
(Django), each one cached independently.

not only you get modularity of code and testability as you describe,
but also avoid the overhead of assembling everything in Python. you
get more URLs and each request could potentially multiply by a sizable
factor, but you get to easily cache complex pieces that stay constant
even if other parts are more variable, or constant on a different
variable...


[1]: https://www.varnish-cache.org/docs/3.0/tutorial/esi.html
[2]: http://nginx.org/en/docs/http/ngx_http_ssi_module.html

--
Javier

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFkDaoTkfnjyOT0LRnPGZpFT6eEm7L%3DgL%3DMZ0%2BXeD7U5b7xYcQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment