index.html
def article_detail(request,article_id):
text = ‘您的文章id是:%s’ %article_id
return HttpResponse(text)
def book(request):
return HttpResponse(“读书页面”)
def movie(request):
return HttpResponse(“电影页面”)
def city(request):
return HttpResponse(“同城页面”)
def book_detail(request,book_id):
text = ‘您的图书id是%s’%book_id
return HttpResponse(text)
def index(request):
return render(request,‘index.html’)
urls.py
from django.urls import path
from . import views
app_name=‘front’
urlpatterns = {
path(‘front/’,views.index,name=‘index’),
path(‘login/’,views.login,name=‘login’),
path(‘book/’,views.book,name=‘book’),
path(‘movie/’,views.movie,name=‘movie’),
path(‘city/’,views.city,name=‘city’),
path(‘book/detail/<book_id>/’,views.book_detail)
# path(‘detail/<article_id>/’,views.article_detail),
}