我试图向我的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/时,遇到了一个错误:
^{pr2}$
修正了我自己的错误,错误在
get_auth()
方法中,我没有将as_view()
添加到view
类中:相关问题 更多 >
编程相关推荐