使用DRF开发API

This commit is contained in:
2025-11-15 12:11:31 +08:00
parent 7010faee4f
commit 3a0e3e9ad1
5 changed files with 25 additions and 2 deletions

12
myapp_api/urls.py Normal file
View 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)),
]