django-Views之request(二)

前端之家收集整理的这篇文章主要介绍了django-Views之request(二)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

book/views.py

def@H_403_5@ index(request):
    http_list @H_403_5@= {
        @H_403_5@'@H_403_5@<h1>请求协议:&nbsp;<span style="color:red">%s</span></h1>@H_403_5@'@H_403_5@ % request.scheme,@H_403_5@<h1>获取完整地址:&nbsp;<span style="color:red">%s</span></h1>@H_403_5@ request.get_full_path(),1)"><h1>端口:&nbsp;<span style="color:red">%s</span></h1>@H_403_5@ request.get_port(),1)"><h1>请求方式:&nbsp;<span style="color:red">%s</span></h1>@H_403_5@ request.method,1)"><h1>完整URL地址:&nbsp;<span style="color:red">%s</span></h1>@H_403_5@ request.get_raw_uri(),}
    @H_403_5@return@H_403_5@ HttpResponse(http_list)

book/urls.py

from@H_403_5@ django.urls import@H_403_5@ path
@H_403_5@from@H_403_5@ .  views
app_name @H_403_5@="@H_403_5@book@H_403_5@"@H_403_5@
urlpatterns @H_403_5@= [
    path(@H_403_5@page/200/@H_403_5@'@H_403_5@,views.index,name=index@H_403_5@),]@H_403_5@

 

猜你在找的Django相关文章