From a5cf01451b93306bf9844a45d2db9ad0d503dc66 Mon Sep 17 00:00:00 2001 From: RogerWork Date: Sun, 10 Dec 2023 01:12:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E7=89=88=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logs/dingxin.log | 45 +++++++++++++++++++++++++++++++++++++++++++++ update/urls.py | 12 ++++++------ 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/logs/dingxin.log b/logs/dingxin.log index 2390753..45e5ece 100644 --- a/logs/dingxin.log +++ b/logs/dingxin.log @@ -412,3 +412,48 @@ INFO 2023-11-07 10:45:54,722 autoreload 266 D:\Code\Work\Python\dingxin_toolbox_ INFO 2023-11-07 10:45:55,519 autoreload 668 Watching for file changes with StatReloader INFO 2023-11-07 16:51:26,696 basehttp 212 "GET /update/cinema_list HTTP/1.1" 301 0 INFO 2023-11-07 16:51:26,827 basehttp 212 "GET /update/cinema_list/ HTTP/1.1" 200 483 +INFO 2023-11-28 09:24:38,139 autoreload 668 Watching for file changes with StatReloader +WARNING 2023-11-28 09:24:41,248 log 241 Not Found: / +WARNING 2023-11-28 09:24:41,249 basehttp 212 "GET / HTTP/1.1" 404 2399 +WARNING 2023-11-28 09:24:42,307 log 241 Not Found: /favicon.ico +WARNING 2023-11-28 09:24:42,344 basehttp 212 "GET /favicon.ico HTTP/1.1" 404 2450 +INFO 2023-11-28 09:25:02,246 basehttp 212 "GET /docs HTTP/1.1" 301 0 +INFO 2023-11-28 09:25:02,610 basehttp 212 "GET /docs/ HTTP/1.1" 200 45133 +INFO 2023-11-28 09:25:03,297 basehttp 212 "GET /static/rest_framework/css/bootstrap.min.css HTTP/1.1" 200 121457 +INFO 2023-11-28 09:25:03,343 basehttp 212 "GET /static/rest_framework/css/bootstrap-theme.min.css HTTP/1.1" 200 23411 +INFO 2023-11-28 09:25:03,343 basehttp 212 "GET /static/rest_framework/docs/css/base.css HTTP/1.1" 200 6156 +INFO 2023-11-28 09:25:03,372 basehttp 212 "GET /static/rest_framework/docs/css/jquery.json-view.min.css HTTP/1.1" 200 1307 +INFO 2023-11-28 09:25:03,376 basehttp 212 "GET /static/rest_framework/css/font-awesome-4.0.3.css HTTP/1.1" 200 21658 +INFO 2023-11-28 09:25:03,398 basehttp 212 "GET /docs/schema.js HTTP/1.1" 200 5536 +INFO 2023-11-28 09:25:03,440 basehttp 212 "GET /static/rest_framework/js/bootstrap.min.js HTTP/1.1" 200 39680 +INFO 2023-11-28 09:25:03,442 basehttp 212 "GET /static/rest_framework/docs/js/jquery.json-view.min.js HTTP/1.1" 200 2700 +INFO 2023-11-28 09:25:03,443 basehttp 212 "GET /static/rest_framework/docs/js/api.js HTTP/1.1" 200 10391 +INFO 2023-11-28 09:25:03,457 basehttp 212 "GET /static/rest_framework/js/coreapi-0.1.1.js HTTP/1.1" 200 157600 +INFO 2023-11-28 09:25:03,490 basehttp 212 "GET /static/rest_framework/js/jquery-3.5.1.min.js HTTP/1.1" 200 89476 +INFO 2023-11-28 09:25:03,554 basehttp 212 "GET /static/rest_framework/fonts/fontawesome-webfont.woff?v=4.0.3 HTTP/1.1" 200 44432 +INFO 2023-11-28 09:25:03,857 basehttp 212 "GET /static/rest_framework/docs/img/favicon.ico HTTP/1.1" 200 5430 +INFO 2023-12-07 08:52:06,039 autoreload 668 Watching for file changes with StatReloader +INFO 2023-12-07 08:54:25,162 autoreload 668 Watching for file changes with StatReloader +INFO 2023-12-07 08:54:44,845 autoreload 266 D:\Code\Work\Python\dingxin_toolbox_drf\update\urls.py changed, reloading. +INFO 2023-12-07 08:54:45,549 autoreload 668 Watching for file changes with StatReloader +INFO 2023-12-07 08:55:02,513 basehttp 212 "GET /docs HTTP/1.1" 301 0 +INFO 2023-12-07 08:55:02,706 basehttp 212 "GET /docs/ HTTP/1.1" 200 53444 +INFO 2023-12-07 08:55:03,304 basehttp 212 "GET /static/rest_framework/css/font-awesome-4.0.3.css HTTP/1.1" 200 21658 +INFO 2023-12-07 08:55:03,331 basehttp 212 "GET /static/rest_framework/docs/css/base.css HTTP/1.1" 200 6156 +INFO 2023-12-07 08:55:03,333 basehttp 212 "GET /static/rest_framework/css/bootstrap-theme.min.css HTTP/1.1" 200 23411 +INFO 2023-12-07 08:55:03,363 basehttp 212 "GET /docs/schema.js HTTP/1.1" 200 7136 +INFO 2023-12-07 08:55:03,373 basehttp 212 "GET /static/rest_framework/css/bootstrap.min.css HTTP/1.1" 200 121457 +INFO 2023-12-07 08:55:03,376 basehttp 212 "GET /static/rest_framework/docs/css/jquery.json-view.min.css HTTP/1.1" 200 1307 +INFO 2023-12-07 08:55:03,405 basehttp 212 "GET /static/rest_framework/js/coreapi-0.1.1.js HTTP/1.1" 200 157600 +INFO 2023-12-07 08:55:03,409 basehttp 212 "GET /static/rest_framework/js/bootstrap.min.js HTTP/1.1" 200 39680 +INFO 2023-12-07 08:55:03,422 basehttp 212 "GET /static/rest_framework/docs/js/jquery.json-view.min.js HTTP/1.1" 200 2700 +INFO 2023-12-07 08:55:03,427 basehttp 212 "GET /static/rest_framework/docs/js/api.js HTTP/1.1" 200 10391 +INFO 2023-12-07 08:55:03,437 basehttp 212 "GET /static/rest_framework/js/jquery-3.5.1.min.js HTTP/1.1" 200 89476 +INFO 2023-12-07 08:55:03,555 basehttp 212 "GET /static/rest_framework/fonts/fontawesome-webfont.woff?v=4.0.3 HTTP/1.1" 200 44432 +INFO 2023-12-07 08:55:04,068 basehttp 212 "GET /static/rest_framework/docs/img/favicon.ico HTTP/1.1" 200 5430 +WARNING 2023-12-07 08:59:58,514 log 241 Unauthorized: /update/cinema/ +WARNING 2023-12-07 08:59:58,515 basehttp 212 "GET /update/cinema/ HTTP/1.1" 401 43 +INFO 2023-12-07 09:00:15,357 basehttp 212 "POST /api-token-auth/ HTTP/1.1" 200 52 +WARNING 2023-12-07 09:00:58,877 log 241 Unauthorized: /update/cinema/ +WARNING 2023-12-07 09:00:58,878 basehttp 212 "GET /update/cinema/ HTTP/1.1" 401 92 +INFO 2023-12-07 09:01:12,551 basehttp 212 "GET /update/cinema/ HTTP/1.1" 200 483 diff --git a/update/urls.py b/update/urls.py index 5bf0c12..b3e3550 100644 --- a/update/urls.py +++ b/update/urls.py @@ -14,13 +14,13 @@ Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ -from django.urls import path +from django.urls import path, include from update import views +from rest_framework.routers import DefaultRouter + +router = DefaultRouter() +router.register('cinema', views.CinemaViewSet, 'cinema') urlpatterns = [ - path('cinema_list/', views.CinemaViewSet.as_view({'get': 'list'})), - path('cinema_add/', views.CinemaViewSet.as_view({'post': 'create'})), - path('cinema_get//', views.CinemaViewSet.as_view({'get': 'retrieve'})), - path('cinema_update//', views.CinemaViewSet.as_view({'put': 'update'})), - path('cinema_delete//', views.CinemaViewSet.as_view({'delete': 'destroy'})), + path('', include(router.urls)), ]