自定义访问频率限制的中间件

自定义访问频率限制的中间件
首先在自定义中间件的文件中导入
from django.utils.deprecation import MiddlewareMixin
from django.shortcuts import HttpResponse
from django.conf import settings
import time

在settings里此配置项后加入中间件路径:文件夹名.py文件名.类名

# 拿到当前访问的ip

猜你喜欢

转载自www.cnblogs.com/zhigu/p/9964318.html