# 1 控制用户登录后才能访问,和不登录就能访问 from rest_framework.permissions import IsAuthenticated class OrderAPIView(APIView):# 登录才能 authentication_classes = [JSONWebTokenAuthentication,] # 权限控制 permission_classes = [IsAuthenticated,] def get(self,request,*args,**kwargs): return Response('这是订单信息') class UserInfoAPIView(APIView):# 不登录就可以 authentication_classes = [JSONWebTokenAuthentication,] # 权限控制 # permission_classes = [IsAuthenticated,] def get(self,request,*args,**kwargs): return Response('UserInfoAPIView')