摘要:
实现效果:除登录接口无需认证,其他接口如果从params或者头部AUTHORIZATION没有获取到token,则直接认证失败。如果去掉NoAuthentication,则支持匿名访问 认证类 from rest_framework.authentication import BaseAuthent 阅读全文
摘要:
认证类(不能写在视图里) rom rest_framework.authentication import BaseAuthentication from rest_framework.exceptions import AuthenticationFailed class MyAuthentica 阅读全文
摘要:
阅读全文
摘要:
路由 urlpatterns = [ path('order/', views.OrderView.as_view()), ] 视图关系 class View(object): @classonlymethod def as_view(cls, **initkwargs): def view(req 阅读全文