The*_*One 1 python django template-engine django-templates mustache
我想将Mustache集成到我的Django应用程序中.用Mustache完全取代Django的模板系统需要采取哪些步骤?
我想让render_to_response与Mustache模板一起正常工作,使用上下文传递所有正确的变量(STATIC_URL,request等).
基本上,您必须render_to_response使用您自己的实现替换该函数,该实现使用您选择的模板系统.Django render_to_response特定于Django的模板系统.这个函数简单地包含了使用django模板引擎时使用的一些常见的grunt-work.Django教程介绍了它们如何工作的基础知识.
使用它django.template.RequestContext来获取TEMPLATE_CONTEXT_PROCESSORS设置中指定的所有上下文变量(其中定义了STATIC_URL,request等).由于RequestContext行为像字典,你应该能够毫无问题地传递给胡子.RequestContext在其构造函数中获取请求对象.
最后,不要忘记返回正确的HttpResponse对象!
因为我不喜欢段落粉丝: