Fork me on GitHub

django-Views之类视图 (六)

book/urls.py

from django.urls import path
from . import views

urlpatterns = [
    path('',views.IndexView.as_view(),name="index"),
]

book/views.py

from django.views import View
from django.shortcuts import render

class IndexView(View):
    def get(self,request):
        return render(request,"index.html")

 

posted @ 2019-10-26 15:19  西西嘛呦  阅读(242)  评论(0编辑  收藏  举报