Django drf 路由系统

路由系统

路由系统可以自动完成增删改查,如果只是增删就不太需要引用

from django.urls import path, re_path, include
from . import views
from rest_framework import routers
router = routers.DefaultRouter()
router.register(r'^xxx', views.View1View)

app_name = 'api'
urlpatterns = [
    re_path(r'^(?P[v1|v2]+)/', include(router.urls))
]

你可能感兴趣的:(Django drf 路由系统)