1、urls.py内容如下
from django.conf.urls import url
from django.urls import path,re_path
urlpattrens = [
path("index/<year>/<month>",view.index)],
2、view.py内容如下
from django.http import HttpResponse
def index(request,year,month):
return HttpResponse("hello world ~~ django,today is %s年/%s月"%(year,month))
启动服务器后,在浏览器中输入
http:127.0.0.1:8000/index/2019/03就可以出现内容