book/views.py
def index(request): http_list = { '<h1>请求协议: <span style="color:red">%s</span></h1>' % request.scheme,<h1>获取完整地址: <span style="color:red">%s</span></h1> request.get_full_path(),1)"><h1>端口: <span style="color:red">%s</span></h1> request.get_port(),1)"><h1>请求方式: <span style="color:red">%s</span></h1> request.method,1)"><h1>完整URL地址: <span style="color:red">%s</span></h1> request.get_raw_uri(),} return HttpResponse(http_list)
book/urls.py
from django.urls import path from . views app_name ="book" urlpatterns = [ path(page/200/',views.index,name=index),]
原文链接:/django/991019.html