update README

This commit is contained in:
myminwang 2018-07-05 12:09:10 +08:00
parent 2e66cb1063
commit bd8ca9116b
16 changed files with 72 additions and 20 deletions

View File

@ -1,20 +1,20 @@
## Django搭建博客
![py27](https://camo.githubusercontent.com/392a32588691a8418368a51ff33a12d41f11f0a9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f707974686f6e2d322e372d6666363962342e737667)
 [![](https://img.shields.io/badge/Django-1.10-green.svg)](http://www.spiderpy.cn/blog/)
[![](https://img.shields.io/badge/Powered%20by-@j_hao104-blue.svg)](http://www.spiderpy.cn/blog/)
## Django搭建个人博客
![py3.6](https://img.shields.io/badge/python-3.6-brightgreen.svg)
 [![](https://img.shields.io/badge/django-2.0-brightgreen.svg)]()
[![](https://img.shields.io/badge/Powered%20by-@问道编程-blue.svg)](http://www.cnblogs.com/wendaobiancheng/)
使用Django快速搭建博客
### 要求
* Python: 2.X
* Django: 1.10.x
* Mysql
### 环境
* Python: 3.X
* Django: 2.0.x
* MySQL
### 示例博客:<http://www.spiderpy.cn/blog>
### 示例博客:<http://www.mylanbitou.top>
### 特点
* 博客文章 markdown 渲染,代码高亮
* 三方社会化评论系统支持(畅言)
* 博客文章 `markdown` 渲染,代码高亮
* 三方社会化评论系统支持(畅言)
* 三种皮肤自由切换
* 阅读排行榜/最新评论
* 多目标源博文分享
@ -23,9 +23,7 @@
### 下载
```
wget https://github.com/jhao104/django-blog/archive/master.zip
or
git clone git@github.com:jhao104/django-blog.git
git clone https://github.com/myminwang/myblog.git
```
### 安装
@ -33,7 +31,7 @@ git clone git@github.com:jhao104/django-blog.git
pip install -r requirements.txt #安装所有依赖
setting.py配置自己的数据库
配置畅言到http://changyan.kuaizhan.com/注册站点,将templates/message.html中js部分换成你在畅言中生成的js。
python manage.py makemigrations blog
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
```
@ -50,7 +48,3 @@ python manage.py runserver
* 文章内容
![文章内容](./doc/image/image3.png)
## 历史版本
* [黑白简约版](https://github.com/jhao104/django-blog/tree/v1.0)

View File

@ -188,3 +188,25 @@ class Tagcloud(View):
'comment_list': comment_list,
'count': count,
})
def page_not_look(request):
"""全局403配置"""
from django.shortcuts import render_to_response
response = render_to_response('403.html',{})
response.status_code = 403
return response
def page_not_found(request):
"""全局404配置"""
from django.shortcuts import render_to_response
response = render_to_response('404.html',{})
response.status_code = 404
return response
def page_error(request):
"""全局500配置"""
from django.shortcuts import render_to_response
response = render_to_response('500.html',{})
response.status_code = 500
return response

BIN
doc/image/image1.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

BIN
doc/image/image2.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 KiB

BIN
doc/image/image3.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

View File

@ -30,7 +30,7 @@ SECRET_KEY = '%oyd37a)%mh0@zts7b)ki5f1u(ibiw9z%6w9-khmz^gvrd+3&2'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
ALLOWED_HOSTS = ['*']
# Application definition

View File

@ -34,3 +34,9 @@ if settings.DEBUG:
# 配置静态文件访问处理
urlpatterns.append(url(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}))
urlpatterns.append(url(r'^static/(?P<path>.*)$', serve, {'document_root': settings.STATIC_ROOT}))
# 全局页面配置
handler403 = 'blog.views.page_not_look'
handler404 = 'blog.views.page_not_found'
handler500 = 'blog.views.page_error'

BIN
static/images/403.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
static/images/404.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

BIN
static/images/500.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

10
templates/403.html Executable file
View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>403</title>
</head>
<body >
<img src="../static/images/403.jpeg" alt="">
</body>
</html>

10
templates/404.html Executable file
View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>404</title>
</head>
<body >
<img src="../static/images/404.jpg" alt="">
</body>
</html>

10
templates/500.html Normal file
View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>500</title>
</head>
<body >
<img src="../static/images/500.png" alt="">
</body>
</html>