{"id":2067,"date":"2023-04-01T21:38:26","date_gmt":"2023-04-01T13:38:26","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=2067"},"modified":"2023-04-06T16:02:11","modified_gmt":"2023-04-06T08:02:11","slug":"python-web-framework-django-template-label","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/04\/01\/python-web-framework-django-template-label\/","title":{"rendered":"Python Web\u6846\u67b6Django\u6a21\u677f\u6807\u7b7e"},"content":{"rendered":"<h2>\u53d8\u91cf\u3001\u5217\u8868\u53ca\u5b57\u5178<\/h2>\n<p>\uff081\uff09\u63a7\u5236\u5668<\/p>\n<pre><code class=\"language-python\">def appblog(request):\n    # context = {}\n    # context[&#039;hello&#039;] = &#039;http:\/\/www.appblog.cn&#039;\n    # return render(request, &#039;test.html&#039;, context)\n    views_var = &#039;http:\/\/www.appblog.cn&#039;  # \u53d8\u91cf\n    views_list = [&quot;AppBlog&quot;, &quot;AliPay&quot;, &quot;WeChat&quot;]  # \u53d8\u91cf\n    views_dict = {&quot;name&quot;: &quot;APP\u5f00\u53d1\u6280\u672f\u535a\u5ba2&quot;}  # \u5b57\u5178\n    return render(request, &#039;test.html&#039;, {&quot;hello&quot;: views_var, &quot;views_list&quot;: views_list, &quot;views_dict&quot;: views_dict})<\/code><\/pre>\n<p><!-- more --><\/p>\n<p>\uff082\uff09\u89c6\u56fe<\/p>\n<pre><code class=\"language-html\">&lt;!DOCTYPE html&gt;\n&lt;html lang=&quot;en&quot;&gt;\n&lt;head&gt;\n    &lt;meta charset=&quot;UTF-8&quot;&gt;\n    &lt;title&gt;Hello&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n&lt;h1&gt;{{ views_var }}&lt;\/h1&gt;\n\n&lt;p&gt;{{ views_list }}&lt;\/p&gt;\n&lt;p&gt;{{ views_list.0 }}&lt;\/p&gt;\n\n&lt;p&gt;{{ views_dict }}&lt;\/p&gt;\n&lt;p&gt;{{ views_dict.name }}&lt;\/p&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u53d8\u91cf\u3001\u5217\u8868\u53ca\u5b57\u5178 \uff081\uff09\u63a7\u5236\u5668 def appblog(request): # context = {} #  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[79],"tags":[522],"class_list":["post-2067","post","type-post","status-publish","format-standard","hentry","category-python","tag-django"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/2067","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=2067"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/2067\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=2067"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=2067"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=2067"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}