librelist archives

« back to archive

Precompiled templates

Precompiled templates

From:
Mayowa Akinyemi
Date:
2010-10-31 @ 11:28
Hello,
Is it possible to use precompiled jinja2 templates with flask?
If it is, would please tell me how or point me to documentation.

Thank you,
Mayowa.

Re: [flask] Precompiled templates

From:
Simon Sapin
Date:
2010-10-31 @ 12:23
Le 31/10/2010 20:28, Mayowa Akinyemi a écrit :
> Hello,
> Is it possible to use precompiled jinja2 templates with flask?
> If it is, would please tell me how or point me to documentation.

Hi,

Do you mean Template objects? You can just use them instead of template 
names in render_template.

But if this is only to avoid reading and compiling templates on every 
request don’t worry: Jinja internally uses a cache of compiled templates.
See the cache_size and auto_reload parameters: 
http://jinja.pocoo.org/api/#jinja2.Environment . These are also 
attributes, eg. app.jinja_env.auto_reload = False

Regards,
-- 
Simon Sapin

Re: [flask] Precompiled templates

From:
Alejandro Castillo
Date:
2010-10-31 @ 17:15
It would be interesting to know how the compiled templates can be
stored and used with the appengine memcached.

2010/10/31 Simon Sapin <simon.sapin@exyr.org>:
> Le 31/10/2010 20:28, Mayowa Akinyemi a écrit :
>> Hello,
>> Is it possible to use precompiled jinja2 templates with flask?
>> If it is, would please tell me how or point me to documentation.
>
> Hi,
>
> Do you mean Template objects? You can just use them instead of template
> names in render_template.
>
> But if this is only to avoid reading and compiling templates on every
> request don’t worry: Jinja internally uses a cache of compiled templates.
> See the cache_size and auto_reload parameters:
> http://jinja.pocoo.org/api/#jinja2.Environment . These are also
> attributes, eg. app.jinja_env.auto_reload = False
>
> Regards,
> --
> Simon Sapin
>

Re: [flask] Precompiled templates

From:
Simon Sapin
Date:
2010-11-01 @ 00:26
Le 01/11/2010 02:15, Alejandro Castillo a écrit :
> It would be interesting to know how the compiled templates can be
> stored and used with the appengine memcached.

Something like this?
http://jinja.pocoo.org/api/#bytecode-cache
http://jinja.pocoo.org/api/#jinja2.MemcachedBytecodeCache

Re: [flask] Precompiled templates

From:
Alejandro Castillo
Date:
2010-11-01 @ 00:47
Thank you!

2010/10/31 Simon Sapin <simon.sapin@exyr.org>:
> Le 01/11/2010 02:15, Alejandro Castillo a écrit :
>> It would be interesting to know how the compiled templates can be
>> stored and used with the appengine memcached.
>
> Something like this?
> http://jinja.pocoo.org/api/#bytecode-cache
> http://jinja.pocoo.org/api/#jinja2.MemcachedBytecodeCache
>

Re: [flask] Precompiled templates

From:
Thadeus Burgess
Date:
2010-10-31 @ 19:25
How would you compile your entire flask application and use that instead?
Including templates?

--
Thadeus




On Sun, Oct 31, 2010 at 12:15 PM, Alejandro Castillo <pyalec@gmail.com>wrote:

> It would be interesting to know how the compiled templates can be
> stored and used with the appengine memcached.
>
> 2010/10/31 Simon Sapin <simon.sapin@exyr.org>:
> > Le 31/10/2010 20:28, Mayowa Akinyemi a écrit :
> >> Hello,
> >> Is it possible to use precompiled jinja2 templates with flask?
> >> If it is, would please tell me how or point me to documentation.
> >
> > Hi,
> >
> > Do you mean Template objects? You can just use them instead of template
> > names in render_template.
> >
> > But if this is only to avoid reading and compiling templates on every
> > request don’t worry: Jinja internally uses a cache of compiled templates.
> > See the cache_size and auto_reload parameters:
> > http://jinja.pocoo.org/api/#jinja2.Environment . These are also
> > attributes, eg. app.jinja_env.auto_reload = False
> >
> > Regards,
> > --
> > Simon Sapin
> >
>

Re: [flask] Precompiled templates

From:
Alejandro Castillo
Date:
2010-10-31 @ 19:41
GAE already precompiles your application.  I believe templates are not included.

2010/10/31 Thadeus Burgess <thadeusb@thadeusb.com>:
> How would you compile your entire flask application and use that instead?
> Including templates?
>
> --
> Thadeus

Re: [flask] Precompiled templates

From:
Thadeus Burgess
Date:
2010-10-31 @ 19:44
Standalone, on apache.

--
Thadeus




On Sun, Oct 31, 2010 at 2:41 PM, Alejandro Castillo <pyalec@gmail.com>wrote:

> GAE already precompiles your application.  I believe templates are not
> included.
>
> 2010/10/31 Thadeus Burgess <thadeusb@thadeusb.com>:
> > How would you compile your entire flask application and use that instead?
> > Including templates?
> >
> > --
> > Thadeus
>