使用DRF开发API
This commit is contained in:
12
myapp_api/urls.py
Normal file
12
myapp_api/urls.py
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
from django.urls import path,include
|
||||
from myapp_api import views
|
||||
from rest_framework import routers
|
||||
|
||||
# 自动注册路由(url)
|
||||
router = routers.DefaultRouter()
|
||||
router.register(r'user', views.UserViewSet)
|
||||
|
||||
urlpatterns = [
|
||||
path('api/', include(router.urls)),
|
||||
]
|
||||
Reference in New Issue
Block a user