views.py:
fromdjango.httpimport HttpResponse from django.views.generic import View class MyView(View): def get(self, request): # <view logic> return HttpResponse('result')
urls.py:
from django.conf.urls import url frommyapp.viewsimport MyView urlpatterns = [ url(r'^about/$', MyView.as_view()), ]
了解有关Django文档的更多信息»