【django】【my_blog】编写第一个页面

2018-05-07  本文已影响11人  JerichoPH

编写第一个页面

创建页面及模板文件夹

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>文章列表页</title>
</head>
<body>
<h1>文章列表页</h1>
</body>
</html>
from django.http import HttpResponse
from django.shortcuts import render


def index(request):
    return render(request=request, template_name='article/index.html')

检查结果,访问:http://localhost:8000/blog/article/index/

结果如下:

image
上一篇 下一篇

猜你喜欢

热点阅读