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)
路由信息配置在項(xiàng)目中urls.py,我們修改下添加自己的路由
from django.contrib import admin
from django.urls import path
from django.urls import re_path
from .views import * “ 導(dǎo)入視圖模塊
urlpatterns = [
path('admin/', admin.site.urls),
path('index/', index), “ index路由
path('order/', orderlist), “ orderlist路由
path('produt/', produtlist), “ produtlist路由
]