def fbv1(request, msg_id=1): """基于函数的视图01""" response = '这是基于函数的视图{}'.format(msg_id) return HttpResponse(response) urlpatterns = [ path('fbv01/<int:msg_id>/', views.fbv1),]