首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏数据分析与挖掘

    django-Views之类视图 (六)

    book/urls.py from django.urls import path from . import views urlpatterns = [ path('',views.IndexView.as_view(),name="index"), ] book/views.py from django.views import View from django.shortcuts import render class IndexView(View): def get(self,r

    37320发布于 2020-08-26
  • 来自专栏数据分析与挖掘

    django-VIews之HttpResponse(一)

    HttpResponse(content,conent_type=None,status=None,charset=None,*args,**kwargst)

    45720发布于 2020-08-26
  • 来自专栏数据分析与挖掘

    django-Views之request(二)

    book/views.py def index(request): http_list = { '

    请求协议: %s

    ' % request.scheme, '

    获取完整地址: %s

    ' % request.get_full_path(), '

    端口: <span s

    37940发布于 2020-08-26
  • 来自专栏数据分析与挖掘

    django-Views之装饰器(四)

    1.选择支持的请求方式 from django.views.decorators.http import require_http_methods from django.shortcuts import render @require_http_methods(['GET','POST']) def index(request): return render(request,"search.html") 2.只允许GET方法 require_GET() 3.只允许POST方法 require_PO

    34520发布于 2020-08-26
  • 来自专栏数据分析与挖掘

    django-Views之使用视图渲染模板(五)

    render(<request>,<template_name>,context=-None,content_type=None,status=None,using=None)

    77320发布于 2020-08-26
  • 来自专栏数据分析与挖掘

    django-Views之常见的几种错误视图代码(三)

    1.404 page not found(找不到对应的页面) 2.500 server error(服务器错误) 3.400 bad request(无效的请求) 4.403 HTTP forbidden(HTTP禁止访问,权限不足) 5.200 OK (请求成功) 重新定义404模板: book/urls.py from django.urls import path from . import views from django.conf.urls import handler404 app_name

    59220发布于 2020-08-26
  • 来自专栏爬虫逆向案例

    014:Django反爬虫和反反爬虫实战讲解

    反爬虫: 1、我在django-views中设置了登录身份验证,设置了装饰器,通过META.get获取请求头,限制请求头和访问间隔。

    74031发布于 2021-11-22
领券