简体   繁体   English

Django视图和模板,包括Jinja2和Mako,教程和资源

[英]Django views and templates, including Jinja2 and Mako, tutorials and resources

I'm new to Python and Django, but now have a pretty firm understanding of basic database and back end programming. 我是Python和Django的新手,但现在对基本数据库和后端编程有了相当的了解。 However, I am finding it hard to learn the views and templates layers. 但是,我发现很难学习视图和模板层。 I was wondering if anyone can suggest additional tutorials and resources, other than the official Django documentation. 我想知道是否有人可以建议除官方Django文档以外的其他教程和资源。

I am also new to HTML, and am open to tutorials using Mako or Jinja2. 我对HTML还是陌生的,并且对使用Mako或Jinja2的教程很开放。

Thanks! 谢谢!

We've been using Mako+Django for almost two years on a large project, and it's been great. 在一个大型项目中,我们已经使用Mako + Django近两年了,这真是太好了。 Mako is immensely better than the standard Django templates. Mako比标准Django模板好得多。 Why on Earth would I want to learn another templating language when I already have to know Python, Javascript, HTML, JQuery, etc.? 为什么当我已经必须了解Python,Javascript,HTML,JQuery等时,为什么还要学习另一种模板语言? With Mako I can use regular Python, including all the libraries, in my HTML pages. 使用Mako,我可以在HTML页面中使用常规Python,包括所有库。 And with Django integrated on the back end, the templates stay simple. 并且在后端集成了Django,模板保持简单。

You might want to look at my Django+Mako starter kit. 您可能想看看我的Django + Mako入门套件。 It does the templates the way I like to do them (not necessarily the standard way), but it is a project fully set up and ready to run. 它按照我喜欢的方式来做模板(不一定是标准方式),但这是一个完全设置并可以运行的项目。 You can start from it and customize. 您可以从中开始并进行自定义。 http://warp.byu.edu/dist/django-mako.zip http://warp.byu.edu/dist/django-mako.zip

Update : blog has moved to http://www.goalbrecht.com/2013/10/django-mako-plus-a-starter-kit/ and additional updates to the project are on Django-Mako-Plus' Github . 更新 :博客已移至http://www.goalbrecht.com/2013/10/django-mako-plus-a-starter-kit/ ,该项目的其他更新位于Django-Mako-Plus'Github上

We use Mako in our workplace, and I highly recommend not using it. 我们在工作场所中使用Mako ,我强烈建议不要使用它。 It's great for your own views, but if you want to use ANY third party libraries that include templates, they simply won't work. 这非常适合您自己的视图,但是如果您想使用任何包含模板的第三方库,它们将根本无法工作。

Other than that, the official documentation, and googling for specific problems you're having is the best way to go when using django templating. 除此之外,使用django模板制作时,最好的方法是使用官方文档以及对特定问题进行谷歌搜索。 Unfortunately, I can't comment on jinja templating. 不幸的是,我无法评论jinja模板。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM