标签:work group framework imp mat python pytho 框架 def
路由: a. url(r‘^(?P<version>[v1|v2]+)/v1/$‘,views.ViewView.as_view()) url(r‘^(?P<version>[v1|v2]+)/v1\.(?P<format>\w+)$‘,views.ViewView.as_view()) b. url(r‘^(?P<version>[v1|v2]+)/v1/(?P<pk>\d+)/$‘,views.ViewView.as_view({‘get‘:‘list‘,})) c. 自动生成路由 from rest_framework import routers routers = routers.DefaultRouter() routers.register(r‘user‘, views.UserInfoView) routers.register(r‘group‘, views.GroupView) urlpatterns = { url(r‘^(?P<version>[v1|v2]+)/‘, include(routers.urls)), }
标签:work group framework imp mat python pytho 框架 def
原文地址:https://www.cnblogs.com/kuku0223/p/11352591.html