Django静态发生器与CACHE_BACKEND [英] Django staticgenerator vs CACHE_BACKEND

查看:122
本文介绍了Django静态发生器与CACHE_BACKEND的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

staticgenerator 和使用Django的 CACHE_BACKEND ,例如。 CACHE_BACKEND ='file:/// var / tmp / django_cache'?

Is there any difference between staticgenerator and useing Django's CACHE_BACKEND on the filesystem eg. CACHE_BACKEND = 'file:///var/tmp/django_cache' ?

推荐答案

是的。

StaticGenerator 生成静态HTML文件,以完全绕过Django

StaticGenerator generates static HTML files to bypass Django entirely.

django执行的任何缓存(如文件系统缓存)仍由django进行处理。运行应用程序的开销大部分仍然存在:django处理请求,通过中间件,检查文件系统缓存的内容等。

Any caching that django does such as the filesystem cache is still processed by django. A lot of the overhead of running your app is still there: django processes a request, goes through middlewares, checks filesystem cache for content, etc.

使用StaticGenerator(及其例如), nginx 正在为 index.html 页面提供(如果不存在),则传递请求在apache上的django。

With StaticGenerator (and their example), nginx is serving the index.html page if it exists and if it doesn't, passes the request on to django on apache.

这个想法是让 nginx 幸运地提供一些 StaticGenerator 更新状态更改(如保存模型)。

The idea is to have nginx blissfully serving some html file that StaticGenerator updates on state changes (like saving a model).

这篇关于Django静态发生器与CACHE_BACKEND的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆