【发布时间】:2018-08-07 23:56:31
【问题描述】:
我正在尝试向我的 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."
}
【问题讨论】:
标签: python django django-rest-framework