添加404界面
This commit is contained in:
parent
a0192e5650
commit
7456441f41
Binary file not shown.
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
Binary file not shown.
291
home/static/404.css
Normal file
291
home/static/404.css
Normal file
File diff suppressed because one or more lines are too long
39
home/templates/404.html
Normal file
39
home/templates/404.html
Normal file
@ -0,0 +1,39 @@
|
||||
{% load static %}
|
||||
<html lang="en"><head>
|
||||
<meta charset="UTF-8">
|
||||
<title>404页面</title>
|
||||
<link rel="stylesheet" href="{% static '404.css' %}">
|
||||
</head>
|
||||
<body>
|
||||
<div class="error">
|
||||
<div class="wrap">
|
||||
<div class="404">
|
||||
<pre><code>
|
||||
<span class="green"><!</span><span>DOCTYPE html</span><span class="green">></span>
|
||||
<span class="orange"><html></span>
|
||||
<span class="orange"><style></span>
|
||||
* {
|
||||
<span class="green">everything</span>:<span class="blue">awesome</span>;
|
||||
}
|
||||
<span class="orange"></style></span>
|
||||
<span class="orange"><body></span>
|
||||
ERROR 404!
|
||||
FILE NOT FOUND!
|
||||
<span class="comment"><!--The file you are looking for,
|
||||
is not where you think it is.-->
|
||||
</span>
|
||||
<span class="orange"></span>
|
||||
</code></pre></div><code>
|
||||
<br>
|
||||
<span class="info">
|
||||
<br>
|
||||
<span class="orange"> </body></span>
|
||||
<br>
|
||||
<span class="orange"></html></span>
|
||||
</span></code>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</body></html>
|
@ -1,4 +1,5 @@
|
||||
from django.shortcuts import render, HttpResponse
|
||||
from django.http import HttpResponseNotFound
|
||||
from pip._vendor.rich.markup import Tag
|
||||
|
||||
from home.models import *
|
||||
@ -88,22 +89,25 @@ def index(request):
|
||||
return render(request, 'index.html', context=get_artchle())
|
||||
# 文章页视图函数
|
||||
def archives(request, id):
|
||||
i = Articles.objects.get(id=id)
|
||||
i.read += 1
|
||||
i.save()
|
||||
try:
|
||||
i = Articles.objects.get(id=id)
|
||||
i.read += 1
|
||||
i.save()
|
||||
|
||||
comments = Comment.objects.filter(archives_id=id).order_by("-comment_time").all()
|
||||
a = get_archives_info(id)
|
||||
for c in comments:
|
||||
com = {
|
||||
"id": c.id,
|
||||
"comment_Content": c.comment_content,
|
||||
"comment_User": c.comment_user,
|
||||
"comment_Time": c.comment_time,
|
||||
"qq": c.qq,
|
||||
}
|
||||
a["comments"].append(com)
|
||||
return render(request, 'archives.html', a)
|
||||
comments = Comment.objects.filter(archives_id=id).order_by("-comment_time").all()
|
||||
a = get_archives_info(id)
|
||||
for c in comments:
|
||||
com = {
|
||||
"id": c.id,
|
||||
"comment_Content": c.comment_content,
|
||||
"comment_User": c.comment_user,
|
||||
"comment_Time": c.comment_time,
|
||||
"qq": c.qq,
|
||||
}
|
||||
a["comments"].append(com)
|
||||
return render(request, 'archives.html', a)
|
||||
except:
|
||||
return render(request, '404.html')
|
||||
# 分类页视图函数
|
||||
def category(request,id):
|
||||
return render(request, 'index.html', context=get_artchle(option=2,id=id))
|
Loading…
x
Reference in New Issue
Block a user