from django.shortcuts import render
from django.http import HttpResponse
def index(request):
html = "html>body>It is index page/body>/html>"
return HttpResponse(html)
def orderlist(request):
html = "html>body>It is order list/body>/html>"
return HttpResponse(html)
def produtlist(request):
html = "html>body>It is produt list/body>/html>"
return HttpResponse(html)
路由信息配置在项目中urls.py,我们修改下添加自己的路由
from django.contrib import admin
from django.urls import path
from django.urls import re_path
from .views import * “ 导入视图模块
urlpatterns = [
path('admin/', admin.site.urls),
path('index/', index), “ index路由
path('order/', orderlist), “ orderlist路由
path('produt/', produtlist), “ produtlist路由
]