1.在wenny目录下新建一个templates包(包名必须是templates),再新建一个a.html文件(名称可随意命名),写入以下内容
我就是最漂亮的烟火
我正在学习django,今天是2020.12.5,希望3个月内学会django
我还是从前那个少年,没有一丝丝改变,时间只不过是考验;一玉口中国,一瓦顶成家,都说国很大,其实一个家;
暖阳下,我迎芬芳;
猜猜我是谁
2.wenny/views.py中添加
from django.shortcuts import render
from django.http import HttpResponse
def index(request):
return HttpResponse("Hello world! yeah...")
def haha(request):
return render(request,'a.html')
3.在fristdemo/urls.py
from django.conf.urls import url
from wenny import views
urlpatterns = [
url(r'^$', views.index),
url(r'^haha$', views.haha),
]
4.打开浏览器输入 http://127.0.0.1:8000/haha
运行成功



