- (一)、更改templates的内容
- 1.更改login.html
- (三)、设置子路由urls.py
- 因为总路由urls.py后面有加斜杠所以子路由不需要加斜杠
- (四)、效果图展示
- 1.shopper页面
- 2.login页面
- 3.logout页面
- 4.shopcart页面
分别更改login.html、shopcart.html、shopper.html
1.更改login.html{% load static %}
def loginView(request):
return render(request,‘login.html’)
def shopcartView(request):
return render(request,‘shopcart.html’)
def logoutView(request):
return HttpResponse(‘成功退出网站~’)
urlpatterns = [
path(‘.html’, shopperView, name=‘shopper’),
path(‘login.html’, loginView, name=‘login’),
path(‘logout.html’, logoutView, name=‘logout’),
path(‘shopcart.html’, shopcartView, name=‘shopcart’)
]



