django--view---001
类视图
继承View类
view 代码
class TestView(View): def get(self,request): return HttpResponse('class view get request') def post(self,request): return HttpResponse('class view post request')
app url写法
urlpatterns = [ path('myapp/class_view/', views.TestView.as_view()), ]
project url写法
urlpatterns = [ path('zong/', include('myapp.urls')), ]
get 请求
post请求
post请求报错时,去掉setting的中间插件
上班求生存,下班求发展