django 的url()函数使用
url()函数用于将视图函数和url关联起来, 下面总结学习过程中对url()与视图函数的参数对应问题
在建立的app-name文件的views.py中,初始内容如下:
from django.shortcuts import render
from django.http import HttpResponse
def home(request):
return render(request, 'home.html')
在templates/home.html:
<!DOCTYPE html>
<html>
<head> <title> Welcome </title> </head>
<body>
<p> hellow world! </p>
</body>
<