python - Using render_templete and static file, which one is faster in Flask -
I am developing a web app using flasks in everybody. There will be Kashmir news pages in my web. The information for each page is stored in the database when the user makes a request in the web browser, then the returned page flask can be generated using render_templates (). The problem occurs when all users request the same page, render_templates () will be asked multiple times for the same page => I'm curious to do the same thing by wasting resources, should I use render_templates () or should I generate the K static pages and instead should use the static file?
You can use the package.
Support cache backends such as Example: . Another option [next to it] Front Page caching Using, like dictionary ,
file system ,
memcached ,
redis , and so on Cash backend
@ cache.cached (timeout = 50) def index (): Return render_template ('index.html')
@ cache.memoize (timeout = 50) def big_foo (a, b): return + a + b + random.randrange (0, 1000) < P>.
@ cache.cached (timeout = 50) def big_foo (): Return Big_bar_calc ()
Comments
Post a Comment