Are you 
using 
https://docs.djangoproject.com/en/2.1/ref/templates/api/#django.template.loaders.cached.Loader
 
in your tests? And you should find a way to test rendering from the command 
line, which will allow you to get much better timing information.

On Friday, 18 January 2019 20:40:29 UTC+11, Goinnn wrote:
>
> I answer between lines
>
>
> El vie., 18 ene. 2019 a las 5:03, shiva kumar (<kannamshi...@gmail.com 
> <javascript:>>) escribió:
>
>> Could you please explain about it. I hadn't understood ur idea.
>>
>
>
>    1. Currently: with you render a view, this render a template. But 
>    usually, this template extends of another and include others. So Django 
> has 
>    to get these templates to create an HTML. This process get time.
>    2. My proposal: Preprocess templates for some (or all) them. Creating 
>    a template without extends or includes. So, in my previous email you can 
>    see, Django render less templates, so Django win time.
>    
> We can get a backend a  little faster with very little effort.
>
> Best!
>
>  
>
>> On Thu 17 Jan, 2019 2:32 pm J. Pablo Martín Cobos <goi...@gmail.com 
>> <javascript:> wrote:
>>
>>> Hi,
>>>
>>> From one year ago, I am using an own command for Django templates that 
>>> unify them. With an example it is easy to see. If I am to render for 
>>> example a template call news.html like it:
>>>
>>> 1. news.html
>>>
>>>     {% extends "base.html" %}
>>>
>>>     {% block title %}
>>>         {% include "inc.news.title.html" %}
>>>     {% endblock %}
>>>
>>>     {% block content %}
>>>         {% for news_item in news %}
>>>             <h2>{{ news_item.title }}</h2>
>>>             <p>{{ news_item.subtitle }}</p>
>>>         {% endfor %}
>>>     {% endblock %}
>>>
>>> 2. base.html
>>>
>>>     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
>>> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
>>>     <html xmlns="http://www.w3.org/1999/xhtml"; lang="{{ 
>>> LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif 
>>> %}>
>>>         <head>
>>>             <title>{% block title %}{% endblock %}</title>
>>>         </head>
>>>         <body>
>>>             {% block content %}{% endblock %}
>>>         </body>
>>>     </html>
>>>
>>> 3. inc.news.title.html
>>>     News
>>>
>>> With this command I preproces every template of a settings variable and 
>>> I get something like this:
>>>
>>> news.unify.html
>>>
>>>     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
>>> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
>>>     <html xmlns="http://www.w3.org/1999/xhtml"; lang="{{ 
>>> LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif 
>>> %}>
>>>         <head>
>>>             <title>News</title>
>>>         </head>
>>>         <body>
>>>             {% for news_item in news %}
>>>                 <h2>{{ news_item.title }}</h2>
>>>                 <p>{{ news_item.subtitle }}</p>
>>>             {% endfor %}
>>>         </body>
>>>     </html>
>>>
>>> So I have a two improves:
>>>
>>>    1. It is more fast. And in a real project a view can render easyly 
>>>    50 templates
>>>    2. I use news.html to develop and news.unify.html to production. So 
>>>    I don't lose legilibility.
>>>    
>>>
>>> What do you think about "unify templates feature"? Do you know if exists 
>>> a similar public project in github/gitlab/bitbucket etc?
>>>
>>>
>>> Best,
>>>
>>> -- 
>>> Pablo Martín Cobos
>>> Computer engineer
>>> Python/Django developer
>>> 652 53 37 36
>>> goi...@gmail.com <javascript:>
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django developers (Contributions to Django itself)" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-develop...@googlegroups.com <javascript:>.
>>> To post to this group, send email to django-d...@googlegroups.com 
>>> <javascript:>.
>>> Visit this group at https://groups.google.com/group/django-developers.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-developers/CALNyWLGNcuK8DTnU9w9fyGFhFfT3dAz7vfj3B%2BnDHWTfneLNFw%40mail.gmail.com
>>>  
>>> <https://groups.google.com/d/msgid/django-developers/CALNyWLGNcuK8DTnU9w9fyGFhFfT3dAz7vfj3B%2BnDHWTfneLNFw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-develop...@googlegroups.com <javascript:>.
>> To post to this group, send email to django-d...@googlegroups.com 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/django-developers.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-developers/CAMsYeuFV3EV_3H%2BR0q9xi5Q6EQq6L2cLkatcvrTtSYW%3D2zRk7A%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/django-developers/CAMsYeuFV3EV_3H%2BR0q9xi5Q6EQq6L2cLkatcvrTtSYW%3D2zRk7A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> Juan Pablo Martín Cobos
> Ingeniero informático
> Desarrollador Python/Django
> 652 53 37 36all 
> goi...@gmail.com <javascript:>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/57a16f30-7fe9-4954-b3df-d367af06a180%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to