我正在尝试为我的django项目添加一些架构视图(我使用this示例)
我的代码:
def get_auth():
auth = [
path('', include('rest_framework.urls', namespace='rest_framework')),
path('register', RegisterApiView),
path('token/obtain/', TokenObtainPairView),
path('token/refresh/', TokenRefreshView),
]
return auth
def get_schema():
schema_url_patterns = [
path('api/auth', include(get_auth())),
]
schema_view = get_schema_view(
title='Auth Schema',
url='/api/auth/',
patterns=schema_url_patterns,
)
return schema_view
urlpatterns = [
path('api/auth/', get_schema()),
]
当我尝试连接到/ api / auth /时遇到错误:
HTTP 403 Forbidden
Allow: GET, HEAD, OPTIONS
Content-Type: application/coreapi+json
Vary: Accept
{
"detail": "You do not have permission to perform this action."
}