Requirements
Request. META is a Python dictionary that contains header information for all HTTP requests, such as the user's IP address and user agent. Through request. Meta.items () can get this dictionary. Requires meta information to be output to a Web page.
Output results
Source Codeindex.html
views.pyFrom django.shortcuts import render# Create your views here.def Display_meta (Request): values = Request. Meta.items () html = {} html[' index_title ']= ' Display META ' html[' index_text ']=values return render ( Request, "index.html", HTML)
Error version index.htmlviews.pyFrom django.shortcuts import render# Create your views here.def Display_meta (Request): values = Request. Meta.items () html = {} html[' Index_text ']= "" html[ ' index_title ']= ' Display META ' for K, V in Values: html[' index_text ']+= (' <tr><td>%s</td><td>%s</td></tr> '% (k, v)) return render (Request, "index.html", HTML)
Output results
As the diagram shows, the browser cannot interpret the output information of the template tag.
SOURCE Download: http://download.csdn.net/detail/a359680405/8388657Python Practice 103----Django Templates