#url.py
?
from django.contrib import admin
from django.urls import path, re_path
from app_drf_books import views
?
urlpatterns = [
path(‘admin/‘, admin.site.urls),
path(‘books/‘, views.BooksAPIView.as_view()),
re_path(‘books/(?P<pk>\d+)‘, views.BookAPIView.as_view())
]
?
#utils.py 自定义工具类
class MyResponse():
def __init__(self):
self.code = 100
self.msg = ‘OK‘
?