如何将 StringTemplate 引擎集成到 CherryPy Web 服务器中
我喜欢 StringTemplate 引擎,也喜欢 CherryPy Web 服务器,而且我知道它们可以集成。
谁做到了? 如何?
编辑:TurboGears 框架采用 CherryPy Web 服务器并捆绑其他相关组件,例如模板引擎、数据访问工具、JavaScript 套件等。我对 MochiKit 感兴趣,需要 CherryPy,但我不想要任何其他模板引擎StringTemplate(架构至关重要——我不想要另一个损坏/坏的模板引擎)。
因此,通过解决如何将 StringTemplate 与 TurboGears 集成来回答这个问题是可以接受的。
通过解决如何在 Google App Engine 中使用 CherryPy 和 StringTemplate 来回答这个问题也可以接受。
谢谢。
I love the StringTemplate engine, and I love the CherryPy web server, and I know that they can be integrated.
Who has done it? How?
EDIT: The TurboGears framework takes the CherryPy web server and bundles other related components such as a template engine, data access tools, JavaScript kit, etc. I am interested in MochiKit, demand CherryPy, but I don't want any other template engine than StringTemplate (architecture is critical--I don't want another broken/bad template engine).
Therefore, it would be acceptable to answer this question by addressing how to integrate StringTemplate with TurboGears.
It may also be acceptable to answer this question by addressing how to use CherryPy and StringTemplate in the Google App Engine.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据两者的教程,它看起来非常简单:
您可能希望让 CherryPy 函数在磁盘上的某个位置找到 StringTemplate,但总体思路是这样的。
Django 在概念上是相似的:url 被映射到 python 函数,并且 python 函数通常构建一个上下文字典,使用该上下文对象呈现一个模板,并返回结果。
Based on the tutorials for both, it looks pretty straightforward:
You'll probably want to have the CherryPy functions find the StringTemplate's in some location on disk instead, but the general idea will be like this.
Django is conceptually similar: url's are mapped to python functions, and the python functions generally build up a context dictionary, render a template with that context object, and return the result.
Rob,
人们选择工具是有原因的。 StringTemplate 在 Python 中并不是很受欢迎,有一些模板引擎得到了更好的支持,并且拥有更广泛的受众。 如果你不喜欢Kid,还有Django的模板、Jinja、Cheetah等。 也许您可以在其中之一中找到您在 StringTemplate 中非常喜欢的功能,并从此过上幸福的生活。
Rob,
There's reason behind people's selection of tools. StringTemplate is not terribly popular for Python, there are templating engines that are much better supported and with a much wider audience. If you don't like Kid, there's also Django's templating, Jinja, Cheetah and others. Perhaps you can find in one of them the features you like so much in StringTemplate and live happily ever after.