2021
01-13
01-13
python drf各类组件的用法和作用
DRF组件的用法和作用认证自定义认证的类"""fromrest_framework.authenticationimportBaseAuthenticationfromrest_framework.exceptionsimportAuthenticationFailedfromauthapp.modelsimportUserTokenclassMyOrderAuthentication(BaseAuthentication):在这里实现认证的逻辑defauthenticate(self,request):token=request._request.GET.get('token')#获取到token之后,需要...
继续阅读 >