django-Views之request

Posted xiximayou

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了django-Views之request相关的知识,希望对你有一定的参考价值。

book/views.py

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

book/urls.py

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

技术图片

 

以上是关于django-Views之request的主要内容,如果未能解决你的问题,请参考以下文章

django-views视图

02-Django-views

Django-Views模块详解

django-view层

Django-View中绕过RSCF验证

django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE的解决办法(转)(代码片段