django drf Token验证
https://www.django-rest-framework.org/api-guide/authentication/#basicauthentication 1.INSTALLED_APPS INSTALLED_APPS = ( ... 'rest_framework.authtoken' ) 2.REST_FRAMEWORK配置 REST_FRAMEWORK = { # 'DEFAULT_PAGINATION_CLASS':'rest_framework.pagination.PageNumberPagination', # 'PAGE_SIZE':2, 'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',), 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework.authentication.BasicAuthentication', 'rest_framework.authentication.SessionAuthentication', 'rest_framework.authentication.TokenAuthentication' ) } 3.migrate生成表 4.创建一个token