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 dictionary , file system , memcached , redis , and so on Cash backend

Example:

  @ 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 ()   

Another option [next to it] Front Page caching Using, like

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -