django 中间键实现部分请求不过滤

from django.utils.deprecation import MiddlewareMixin
from django.http import HttpResponseRedirect
class MyMiddle(MiddlewareMixin):
    def process_request(self,request):
       if '/RPMSapp/login/' != request.path and '/RPMSapp/login_check/'!= request.path:
            a = request.session.get('userName')
            if a == None:
                return HttpResponseRedirect('/RPMSapp/login/')

'/RPMSapp/login/'
/RPMSapp/login_check/'为登录的url
 
阅读更多
个人分类: 干货
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭