Django staticgenerator vs CACHE_BACKEND

依然范特西╮ 提交于 2019-12-23 03:53:30

问题


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


回答1:


Yes.

StaticGenerator generates static HTML files to bypass Django entirely.

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.

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.

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



来源:https://stackoverflow.com/questions/4988270/django-staticgenerator-vs-cache-backend

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!