├── app ├── __init__.py ├── apps.py ├── static │ └── blog │ │ ├── css │ │ ├── pace.css │ │ ├── highlights │ │ │ ├── vs.css │ │ │ ├── bw.css │ │ │ ├── zenburn.css │ │ │ ├── borland.css │ │ │ ├── autumn.css │ │ │ ├── perldoc.css │ │ │ ├── monokai.css │ │ │ ├── trac.css │ │ │ ├── emacs.css │ │ │ ├── friendly.css │ │ │ ├── default.css │ │ │ ├── github.css │ │ │ ├── manni.css │ │ │ ├── vim.css │ │ │ ├── colorful.css │ │ │ ├── murphy.css │ │ │ ├── pastie.css │ │ │ ├── native.css │ │ │ ├── fruity.css │ │ │ └── tango.css │ │ └── custom.css │ │ └── js │ │ ├── script.js │ │ ├── modernizr.custom.js │ │ └── pace.min.js ├── tests.py ├── urls.py ├── index.py ├── views.py ├── admin.py ├── upload_views.py ├── util.py └── models.py ├── weixin ├── __init__.py ├── tests.py ├── admin.py ├── views.py ├── apps.py ├── urls.py ├── index.py ├── utils.py └── models.py ├── project ├── __init__.py ├── wsgi.py ├── urls.py └── settings.py ├── README.txt ├── requirement.txt ├── .gitignore ├── manage.py └── templates ├── blog ├── index.html ├── detail.html ├── contact.html ├── about.html ├── full-width.html ├── index_tmp.html └── detail_tmp.html └── base.html /app/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /weixin/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /project/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | 基于django2.0搭建的个人博客 2 | 3 | -------------------------------------------------------------------------------- /weixin/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /weixin/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /weixin/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | -------------------------------------------------------------------------------- /app/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AppConfig(AppConfig): 5 | name = 'app' 6 | -------------------------------------------------------------------------------- /weixin/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class WeixinConfig(AppConfig): 5 | name = 'weixin' 6 | -------------------------------------------------------------------------------- /requirement.txt: -------------------------------------------------------------------------------- 1 | django==2.1.1 2 | mysqlclient==1.3.13 3 | markdown==3.0.1 4 | Pygments==2.2.0 5 | gunicorn==19.9.0 6 | requests==2.19.1 7 | filetype==1.0.1 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | project/localsetting.py 2 | app/localtest.py 3 | .idea/* 4 | app/__pycache__/* 5 | project/__pycache__/* 6 | weixin/__pycache__/* 7 | app/migrations/* 8 | logs/* 9 | weixin/localtest.py -------------------------------------------------------------------------------- /app/static/blog/css/pace.css: -------------------------------------------------------------------------------- 1 | .pace .pace-progress { 2 | background: #000; 3 | position: fixed; 4 | z-index: 2000; 5 | top: 0; 6 | left: 0; 7 | height: 1px; 8 | transition: width 1s; 9 | } 10 | 11 | .pace-inactive { 12 | display: none; 13 | } -------------------------------------------------------------------------------- /app/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | from app.models import Blog 3 | # Create your tests here. 4 | 5 | class TestModel(TestCase): 6 | 7 | 8 | def test_get_blog(self): 9 | blog = Blog.getBlogById(1) 10 | print(blog.id) 11 | print(blog.title) 12 | self.assertEqual(True, True) 13 | 14 | 15 | -------------------------------------------------------------------------------- /weixin/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from weixin import index 3 | from django.conf import settings 4 | 5 | 6 | # 微信公众号后台提供的url 7 | weixin_patterns = [ 8 | path("/", index.index), 9 | 10 | ] 11 | 12 | if settings.DEBUG: 13 | from weixin import localtest 14 | weixin_patterns.append(path("/test", localtest.test)) 15 | 16 | 17 | -------------------------------------------------------------------------------- /project/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for myblog project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings') 15 | 16 | application = get_wsgi_application() 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/urls.py: -------------------------------------------------------------------------------- 1 | ## 博客url 2 | from django.urls import path 3 | from app import index, admin, upload_views 4 | 5 | 6 | app_name = "app" 7 | blog_patterns = [ 8 | path("", index.index), 9 | path("article/", index.detail, name="detail"), 10 | 11 | # 管理接口 12 | path("admin/createBlog", admin.createBlog), 13 | path("admin/updateBlog", admin.updateBlog), 14 | 15 | # 上传图片的接口 16 | path("upload/image", upload_views.uploadImage), 17 | 18 | 19 | ] 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /templates/blog/index.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block main %} 4 | 5 | {% for blog in blogList %} 6 |
7 |

8 | {{ blog.title }} 9 |

10 | 14 |
15 |

{{ blog.digest }}

16 |
17 | 继续阅读 + 18 |
19 |
20 |
21 | {% endfor %} 22 | 23 | {% endblock main %} 24 | -------------------------------------------------------------------------------- /project/urls.py: -------------------------------------------------------------------------------- 1 | """myblog URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | from app.urls import blog_patterns 19 | from weixin.urls import weixin_patterns 20 | 21 | urlpatterns = [ 22 | path("blog/", include(blog_patterns)), 23 | path("weixin", include(weixin_patterns)), 24 | 25 | ] 26 | -------------------------------------------------------------------------------- /app/index.py: -------------------------------------------------------------------------------- 1 | from django.http import request, JsonResponse 2 | from django.shortcuts import render 3 | from app.models import Blog 4 | from app.views import returnNotFound, returnOk 5 | import markdown 6 | from app.util import Date 7 | 8 | 9 | # 首页视图 10 | def index(request): 11 | blogs = Blog.getAllBlog() 12 | return render(request, "blog/index.html", context={"blogList":blogs}) 13 | 14 | 15 | # 获取详情的视图 16 | def detail(request, blogId): 17 | blog = Blog.getBlogById(blogId) 18 | if not blog: 19 | return returnNotFound("博客不存在") 20 | # 自增pv 21 | blog.increaseViews() 22 | blog.content = markdown.markdown(blog.content, 23 | extensions=[ 24 | "markdown.extensions.extra", 25 | "markdown.extensions.codehilite", 26 | "markdown.extensions.toc" 27 | ]) 28 | return render(request, "blog/detail.html", context={"blog":blog}) 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/views.py: -------------------------------------------------------------------------------- 1 | from django.http import JsonResponse, HttpResponse, HttpResponseRedirect 2 | 3 | # Create your views here. 4 | 5 | def returnBase(message="", code=1, status=400): 6 | data = { 7 | "err_code": code, 8 | "message":message 9 | } 10 | return JsonResponse(data, status=status) 11 | 12 | def returnNotFound(message, code=1): 13 | return returnBase(message, code) 14 | 15 | def returnOk(data=None): 16 | if not data: 17 | data = {} 18 | return JsonResponse(data=data, status=200) 19 | 20 | def returnBadRequest(message, code=1): 21 | return returnBase(message, code) 22 | 23 | def returnForbidden(message, code=1): 24 | return returnBase(message, code, status=403) 25 | 26 | def returnRedirect(location): 27 | return HttpResponseRedirect(location) 28 | 29 | # 检查参数 30 | def checkPara(dataMap, keyList): 31 | if not isinstance(dataMap, dict) or not isinstance(keyList, list): 32 | return False 33 | 34 | result = [True] 35 | for k in keyList: 36 | if k not in dataMap: 37 | if result[0] == True: 38 | result[0] = "Need para: " + k 39 | value = None 40 | else: 41 | value = dataMap[k] 42 | result.append(value) 43 | 44 | return tuple(result) 45 | -------------------------------------------------------------------------------- /app/admin.py: -------------------------------------------------------------------------------- 1 | """ 2 | 管理员操作 3 | """ 4 | 5 | from django.http import request 6 | from app.models import Blog 7 | from app.views import returnOk, returnNotFound, checkPara, returnBadRequest 8 | from django.views.decorators.http import require_http_methods 9 | from app.util import Auth 10 | 11 | 12 | # 创建博客的接口 13 | @require_http_methods(["POST"]) 14 | def createBlog(request): 15 | if not Auth.checkOperator(request): 16 | return returnBadRequest("权限校验失败") 17 | 18 | result, title, content = checkPara(request.POST, [ 19 | "title", "content" 20 | ]) 21 | if result != True: 22 | return returnBadRequest(result) 23 | 24 | blog = Blog( 25 | title=title, 26 | content=content 27 | ) 28 | blog.save() 29 | 30 | return returnOk() 31 | 32 | 33 | # 更新博客的接口 34 | @require_http_methods(["POST"]) 35 | def updateBlog(request): 36 | if not Auth.checkOperator(request): 37 | return returnBadRequest("权限校验失败") 38 | 39 | result, blogId, title, content = checkPara(request.POST, [ 40 | "blogId", "title", "content" 41 | ]) 42 | if result != True: 43 | return returnBadRequest(result) 44 | 45 | blog = Blog.getBlogById(blogId) 46 | if not blog: 47 | return returnBadRequest("博客不存在") 48 | 49 | blog.title = title 50 | blog.content = content 51 | blog.save() 52 | 53 | return returnOk() 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /templates/blog/detail.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block main %} 4 |
5 |
6 |

{{ blog.title }}

7 | 14 |
15 |
16 | {{ blog.content|safe }} 17 |
18 |
19 | 20 | 21 | 22 | {% endblock main %} 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /app/static/blog/css/highlights/vs.css: -------------------------------------------------------------------------------- 1 | .codehilite .hll { background-color: #ffffcc } 2 | .codehilite .c { color: #008000 } /* Comment */ 3 | .codehilite .err { border: 1px solid #FF0000 } /* Error */ 4 | .codehilite .k { color: #0000ff } /* Keyword */ 5 | .codehilite .cm { color: #008000 } /* Comment.Multiline */ 6 | .codehilite .cp { color: #0000ff } /* Comment.Preproc */ 7 | .codehilite .c1 { color: #008000 } /* Comment.Single */ 8 | .codehilite .cs { color: #008000 } /* Comment.Special */ 9 | .codehilite .ge { font-style: italic } /* Generic.Emph */ 10 | .codehilite .gh { font-weight: bold } /* Generic.Heading */ 11 | .codehilite .gp { font-weight: bold } /* Generic.Prompt */ 12 | .codehilite .gs { font-weight: bold } /* Generic.Strong */ 13 | .codehilite .gu { font-weight: bold } /* Generic.Subheading */ 14 | .codehilite .kc { color: #0000ff } /* Keyword.Constant */ 15 | .codehilite .kd { color: #0000ff } /* Keyword.Declaration */ 16 | .codehilite .kn { color: #0000ff } /* Keyword.Namespace */ 17 | .codehilite .kp { color: #0000ff } /* Keyword.Pseudo */ 18 | .codehilite .kr { color: #0000ff } /* Keyword.Reserved */ 19 | .codehilite .kt { color: #2b91af } /* Keyword.Type */ 20 | .codehilite .s { color: #a31515 } /* Literal.String */ 21 | .codehilite .nc { color: #2b91af } /* Name.Class */ 22 | .codehilite .ow { color: #0000ff } /* Operator.Word */ 23 | .codehilite .sb { color: #a31515 } /* Literal.String.Backtick */ 24 | .codehilite .sc { color: #a31515 } /* Literal.String.Char */ 25 | .codehilite .sd { color: #a31515 } /* Literal.String.Doc */ 26 | .codehilite .s2 { color: #a31515 } /* Literal.String.Double */ 27 | .codehilite .se { color: #a31515 } /* Literal.String.Escape */ 28 | .codehilite .sh { color: #a31515 } /* Literal.String.Heredoc */ 29 | .codehilite .si { color: #a31515 } /* Literal.String.Interpol */ 30 | .codehilite .sx { color: #a31515 } /* Literal.String.Other */ 31 | .codehilite .sr { color: #a31515 } /* Literal.String.Regex */ 32 | .codehilite .s1 { color: #a31515 } /* Literal.String.Single */ 33 | .codehilite .ss { color: #a31515 } /* Literal.String.Symbol */ 34 | -------------------------------------------------------------------------------- /app/static/blog/css/highlights/bw.css: -------------------------------------------------------------------------------- 1 | .codehilite .hll { background-color: #ffffcc } 2 | .codehilite .c { font-style: italic } /* Comment */ 3 | .codehilite .err { border: 1px solid #FF0000 } /* Error */ 4 | .codehilite .k { font-weight: bold } /* Keyword */ 5 | .codehilite .cm { font-style: italic } /* Comment.Multiline */ 6 | .codehilite .c1 { font-style: italic } /* Comment.Single */ 7 | .codehilite .cs { font-style: italic } /* Comment.Special */ 8 | .codehilite .ge { font-style: italic } /* Generic.Emph */ 9 | .codehilite .gh { font-weight: bold } /* Generic.Heading */ 10 | .codehilite .gp { font-weight: bold } /* Generic.Prompt */ 11 | .codehilite .gs { font-weight: bold } /* Generic.Strong */ 12 | .codehilite .gu { font-weight: bold } /* Generic.Subheading */ 13 | .codehilite .kc { font-weight: bold } /* Keyword.Constant */ 14 | .codehilite .kd { font-weight: bold } /* Keyword.Declaration */ 15 | .codehilite .kn { font-weight: bold } /* Keyword.Namespace */ 16 | .codehilite .kr { font-weight: bold } /* Keyword.Reserved */ 17 | .codehilite .s { font-style: italic } /* Literal.String */ 18 | .codehilite .nc { font-weight: bold } /* Name.Class */ 19 | .codehilite .ni { font-weight: bold } /* Name.Entity */ 20 | .codehilite .ne { font-weight: bold } /* Name.Exception */ 21 | .codehilite .nn { font-weight: bold } /* Name.Namespace */ 22 | .codehilite .nt { font-weight: bold } /* Name.Tag */ 23 | .codehilite .ow { font-weight: bold } /* Operator.Word */ 24 | .codehilite .sb { font-style: italic } /* Literal.String.Backtick */ 25 | .codehilite .sc { font-style: italic } /* Literal.String.Char */ 26 | .codehilite .sd { font-style: italic } /* Literal.String.Doc */ 27 | .codehilite .s2 { font-style: italic } /* Literal.String.Double */ 28 | .codehilite .se { font-weight: bold; font-style: italic } /* Literal.String.Escape */ 29 | .codehilite .sh { font-style: italic } /* Literal.String.Heredoc */ 30 | .codehilite .si { font-weight: bold; font-style: italic } /* Literal.String.Interpol */ 31 | .codehilite .sx { font-style: italic } /* Literal.String.Other */ 32 | .codehilite .sr { font-style: italic } /* Literal.String.Regex */ 33 | .codehilite .s1 { font-style: italic } /* Literal.String.Single */ 34 | .codehilite .ss { font-style: italic } /* Literal.String.Symbol */ 35 | -------------------------------------------------------------------------------- /weixin/index.py: -------------------------------------------------------------------------------- 1 | """ 2 | index 视图 3 | """ 4 | from app.views import returnOk, returnBadRequest, checkPara, returnForbidden 5 | from django.http import request 6 | from django.http import HttpResponse 7 | from weixin.utils import checkSignature, WeixinParser 8 | from app.util import FileLogger 9 | from weixin.models import Weixin, User 10 | from django.conf import settings 11 | 12 | # 推送入口 13 | def index(request): 14 | # 校验合法性 15 | result, signature, timestamp, nonce = checkPara(request.GET, [ 16 | "signature", "timestamp", "nonce" 17 | ]) 18 | if result != True: 19 | return returnBadRequest(result) 20 | 21 | if not checkSignature(signature, timestamp, nonce): 22 | return returnForbidden("Fuck off.") 23 | 24 | # 如果是校验请求 25 | if request.method == "GET": 26 | echostr = request.GET.get("echostr") 27 | return HttpResponse(echostr) 28 | 29 | msgData = WeixinParser.parseXml(request.body) 30 | FileLogger.log_info("weixin_parse_data", msgData.__dict__, handler_name=FileLogger.WEIXIN_HANDLER) 31 | if msgData.msgType == "event": # 推送事件 32 | if msgData.event == "subscribe" or msgData.event == "SCAN": 33 | if msgData.event == "subscribe": 34 | sceneId = str(msgData.eventKey).split("_")[1] 35 | else: 36 | sceneId = str(msgData.eventKey) 37 | 38 | FileLogger.log_info("xxxxxxxxxxxx_look_there_xxxxxxxxxxxxxx", msgData, FileLogger.WEIXIN_HANDLER) 39 | # 拉取用户信息 40 | res = Weixin.getUserInfo(msgData.fromUserName) 41 | res.update({"sceneId": sceneId}) 42 | # pPushDataToAccountCenter(res) 43 | 44 | resData = WeixinParser.returnTextMessage(msgData.fromUserName, "你什么关注我?(羞赧)") 45 | 46 | return HttpResponse(resData, content_type="application/xml") 47 | 48 | 49 | # # 推送数据 50 | # def pPushDataToAccountCenter(data): 51 | # url = settings.YOUCLOUD_ACCOUNT_CENTER_HOST + "/weixin/data_push" 52 | # para = { 53 | # "sceneId": data["sceneId"], 54 | # "unionId": data["unionid"], 55 | # "nickname": data, 56 | # "headImgUrl": data, 57 | # "country": data, 58 | # "province": data, 59 | # "city": data, 60 | # "sex": data 61 | # } 62 | # 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /app/static/blog/css/highlights/zenburn.css: -------------------------------------------------------------------------------- 1 | 2 | .codehilite code, .codehilite pre{color:#fdce93;background-color:#3f3f3f} 3 | .codehilite .hll{background-color:#222} 4 | .codehilite .c{color:#7f9f7f} 5 | .codehilite .err{color:#e37170;background-color:#3d3535} 6 | .codehilite .g{color:#7f9f7f} 7 | .codehilite .k{color:#f0dfaf} 8 | .codehilite .l{color:#ccc} 9 | .codehilite .n{color:#dcdccc} 10 | .codehilite .o{color:#f0efd0} 11 | .codehilite .x{color:#ccc} 12 | .codehilite .p{color:#41706f} 13 | .codehilite .cm{color:#7f9f7f} 14 | .codehilite .cp{color:#7f9f7f} 15 | .codehilite .c1{color:#7f9f7f} 16 | .codehilite .cs{color:#cd0000;font-weight:bold} 17 | .codehilite .gd{color:#cd0000} 18 | .codehilite .ge{color:#ccc;font-style:italic} 19 | .codehilite .gr{color:red} 20 | .codehilite .gh{color:#dcdccc;font-weight:bold} 21 | .codehilite .gi{color:#00cd00} 22 | .codehilite .go{color:gray} 23 | .codehilite .gp{color:#dcdccc;font-weight:bold} 24 | .codehilite .gs{color:#ccc;font-weight:bold} 25 | .codehilite .gu{color:purple;font-weight:bold} 26 | .codehilite .gt{color:#0040D0} 27 | .codehilite .kc{color:#dca3a3} 28 | .codehilite .kd{color:#ffff86} 29 | .codehilite .kn{color:#dfaf8f;font-weight:bold} 30 | .codehilite .kp{color:#cdcf99} 31 | .codehilite .kr{color:#cdcd00} 32 | .codehilite .kt{color:#00cd00} 33 | .codehilite .ld{color:#cc9393} 34 | .codehilite .m{color:#8cd0d3} 35 | .codehilite .s{color:#cc9393} 36 | .codehilite .na{color:#9ac39f} 37 | .codehilite .nb{color:#efef8f} 38 | .codehilite .nc{color:#efef8f} 39 | .codehilite .no{color:#ccc} 40 | .codehilite .nd{color:#ccc} 41 | .codehilite .ni{color:#c28182} 42 | .codehilite .ne{color:#c3bf9f;font-weight:bold} 43 | .codehilite .nf{color:#efef8f} 44 | .codehilite .nl{color:#ccc} 45 | .codehilite .nn{color:#8fbede} 46 | .codehilite .nx{color:#ccc} 47 | .codehilite .py{color:#ccc} 48 | .codehilite .nt{color:#9ac39f} 49 | .codehilite .nv{color:#dcdccc} 50 | .codehilite .ow{color:#f0efd0} 51 | .codehilite .w{color:#ccc} 52 | .codehilite .mf{color:#8cd0d3} 53 | .codehilite .mh{color:#8cd0d3} 54 | .codehilite .mi{color:#8cd0d3} 55 | .codehilite .mo{color:#8cd0d3} 56 | .codehilite .sb{color:#cc9393} 57 | .codehilite .sc{color:#cc9393} 58 | .codehilite .sd{color:#cc9393} 59 | .codehilite .s2{color:#cc9393} 60 | .codehilite .se{color:#cc9393} 61 | .codehilite .sh{color:#cc9393} 62 | .codehilite .si{color:#cc9393} 63 | .codehilite .sx{color:#cc9393} 64 | .codehilite .sr{color:#cc9393} 65 | .codehilite .s1{color:#cc9393} 66 | .codehilite .ss{color:#cc9393} 67 | .codehilite .bp{color:#efef8f} 68 | .codehilite .vc{color:#efef8f} 69 | .codehilite .vg{color:#dcdccc} 70 | .codehilite .vi{color:#ffffc7} 71 | .codehilite .il{color:#8cd0d3} 72 | -------------------------------------------------------------------------------- /app/upload_views.py: -------------------------------------------------------------------------------- 1 | """ 2 | 文件上传视图 3 | """ 4 | from django.views.decorators.http import require_http_methods 5 | import filetype, hashlib 6 | from app.views import returnOk, returnForbidden, returnBadRequest 7 | from app.models import UploadImage 8 | from app.util import FileLogger, Auth 9 | from django.conf import settings 10 | 11 | # 上传文件的视图 12 | @require_http_methods(["POST"]) 13 | def uploadImage(request): 14 | if not Auth.checkOperator(request): 15 | return returnForbidden("无权限") 16 | 17 | file = request.FILES.get("img", None) 18 | if not file: 19 | return returnBadRequest("need file.") 20 | 21 | # 图片大小限制 22 | if not pIsAllowedFileSize(file.size): 23 | return returnForbidden("文件太大") 24 | 25 | # 计算文件md5 26 | md5 = pCalculateMd5(file) 27 | uploadImg = UploadImage.getImageByMd5(md5) 28 | if uploadImg: # 文件已存在 29 | return returnOk({'url': uploadImg.getImageUrl()}) 30 | 31 | # 获取扩展类型 并 判断 32 | ext = pGetFileExtension(file) 33 | if not pIsAllowedImageType(ext): 34 | return returnForbidden("文件类型错误") 35 | 36 | # 检测通过 创建新的image对象 37 | uploadImg = UploadImage() 38 | uploadImg.filename = file.name 39 | uploadImg.file_size = file.size 40 | uploadImg.file_md5 = md5 41 | uploadImg.file_type = ext 42 | uploadImg.save() 43 | 44 | # 保存 文件到磁盘 45 | with open(uploadImg.getImagePath(), "wb+") as f: 46 | # 分块写入 47 | for chunk in file.chunks(): 48 | f.write(chunk) 49 | 50 | # 文件日志 51 | FileLogger.log_info("upload_image", uploadImg, FileLogger.IMAGE_HANDLER) 52 | 53 | return returnOk({"url": uploadImg.getImageUrl()}) 54 | 55 | 56 | 57 | # 检测文件类型 58 | def pGetFileExtension(file): 59 | rawData = bytearray() 60 | for c in file.chunks(): 61 | rawData += c 62 | try: 63 | ext = filetype.guess_extension(rawData) 64 | return ext 65 | except Exception as e: 66 | # todo log 67 | return None 68 | 69 | 70 | # 计算文件的md5 71 | def pCalculateMd5(file): 72 | md5Obj = hashlib.md5() 73 | for chunk in file.chunks(): 74 | md5Obj.update(chunk) 75 | return md5Obj.hexdigest() 76 | 77 | 78 | # 文件类型过滤 79 | def pIsAllowedImageType(ext): 80 | if ext in ["png", "jpeg", "jpg"]: 81 | return True 82 | return False 83 | 84 | # 文件大小限制 85 | def pIsAllowedFileSize(size): 86 | limit = settings.IMAGE_SIZE_LIMIT 87 | if size < limit: 88 | return True 89 | return False 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /weixin/utils.py: -------------------------------------------------------------------------------- 1 | """ 2 | 工具类 3 | """ 4 | from django.conf import settings 5 | import hashlib, datetime 6 | from xml.etree import ElementTree 7 | 8 | # 微信签名验证方法 9 | def checkSignature(signature, timestamp, nonce): 10 | token = settings.WEIXIN_OPEN_TOKEN 11 | tmpArr = [token, timestamp, nonce] 12 | tmpArr.sort() 13 | strTmp = tmpArr[0] + tmpArr[1] + tmpArr[2] 14 | sigLoc = hashlib.sha1(strTmp.encode("utf8")).hexdigest() 15 | if sigLoc == signature: 16 | return True 17 | return False 18 | 19 | 20 | # 解析微信xml消息 21 | class WeixinParser: 22 | 23 | @classmethod 24 | def parseXml(cls, data): 25 | if len(data) == 0: 26 | return None 27 | xmlData = ElementTree.fromstring(data) 28 | msgType = xmlData.find("MsgType").text 29 | if msgType == "event": 30 | event = xmlData.find("Event").text 31 | if event == "subscribe" or event == "SCAN": 32 | return cls.ScanMsg(xmlData) 33 | else: 34 | return cls.EventMsg(xmlData) 35 | elif msgType == "text": 36 | return cls.TextMsg(xmlData) 37 | else: 38 | return cls.Msg(xmlData) 39 | 40 | 41 | class Msg(object): 42 | def __init__(self, xmlData): 43 | self.toUserName = xmlData.find("ToUserName").text 44 | self.fromUserName = xmlData.find("FromUserName").text 45 | self.createTime = xmlData.find("CreateTime").text 46 | self.msgType = xmlData.find("MsgType").text 47 | 48 | class EventMsg(Msg): 49 | 50 | def __init__(self, xmlData): 51 | super().__init__(xmlData) 52 | self.event = xmlData.find("Event").text 53 | 54 | class TextMsg(Msg): 55 | 56 | def __init__(self, xmlData): 57 | super().__init__(xmlData) 58 | self.content = xmlData.find("Content").text.encode("utf-8") 59 | self.msgId = xmlData.find("MsgId").text 60 | 61 | class ScanMsg(EventMsg): 62 | 63 | def __init__(self, xmlData): 64 | super().__init__(xmlData) 65 | self.eventKey = xmlData.find("EventKey").text 66 | 67 | def __str__(self): 68 | return self.fromUserName + " - " + self.toUserName + " - " +self.msgType + " - " + self.event + " - " + self.eventKey 69 | 70 | 71 | # 返回普通消息 72 | @classmethod 73 | def returnTextMessage(cls, toUser, content): 74 | fromUser = settings.WEIXIN_ACCOUNT_ID 75 | time = datetime.datetime.timestamp() 76 | xmlMessage = """ 77 | < ![CDATA[%s] ]> 78 | < ![CDATA[%s] ]> 79 | %d 80 | < ![CDATA[text] ]> 81 | < ![CDATA[%s] ]> 82 | 83 | """%(toUser, fromUser, time, content) 84 | return xmlMessage 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /app/static/blog/css/highlights/borland.css: -------------------------------------------------------------------------------- 1 | .codehilite .hll { background-color: #ffffcc } 2 | .codehilite .c { color: #008800; font-style: italic } /* Comment */ 3 | .codehilite .err { color: #a61717; background-color: #e3d2d2 } /* Error */ 4 | .codehilite .k { color: #000080; font-weight: bold } /* Keyword */ 5 | .codehilite .cm { color: #008800; font-style: italic } /* Comment.Multiline */ 6 | .codehilite .cp { color: #008080 } /* Comment.Preproc */ 7 | .codehilite .c1 { color: #008800; font-style: italic } /* Comment.Single */ 8 | .codehilite .cs { color: #008800; font-weight: bold } /* Comment.Special */ 9 | .codehilite .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ 10 | .codehilite .ge { font-style: italic } /* Generic.Emph */ 11 | .codehilite .gr { color: #aa0000 } /* Generic.Error */ 12 | .codehilite .gh { color: #999999 } /* Generic.Heading */ 13 | .codehilite .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ 14 | .codehilite .go { color: #888888 } /* Generic.Output */ 15 | .codehilite .gp { color: #555555 } /* Generic.Prompt */ 16 | .codehilite .gs { font-weight: bold } /* Generic.Strong */ 17 | .codehilite .gu { color: #aaaaaa } /* Generic.Subheading */ 18 | .codehilite .gt { color: #aa0000 } /* Generic.Traceback */ 19 | .codehilite .kc { color: #000080; font-weight: bold } /* Keyword.Constant */ 20 | .codehilite .kd { color: #000080; font-weight: bold } /* Keyword.Declaration */ 21 | .codehilite .kn { color: #000080; font-weight: bold } /* Keyword.Namespace */ 22 | .codehilite .kp { color: #000080; font-weight: bold } /* Keyword.Pseudo */ 23 | .codehilite .kr { color: #000080; font-weight: bold } /* Keyword.Reserved */ 24 | .codehilite .kt { color: #000080; font-weight: bold } /* Keyword.Type */ 25 | .codehilite .m { color: #0000FF } /* Literal.Number */ 26 | .codehilite .s { color: #0000FF } /* Literal.String */ 27 | .codehilite .na { color: #FF0000 } /* Name.Attribute */ 28 | .codehilite .nt { color: #000080; font-weight: bold } /* Name.Tag */ 29 | .codehilite .ow { font-weight: bold } /* Operator.Word */ 30 | .codehilite .w { color: #bbbbbb } /* Text.Whitespace */ 31 | .codehilite .mf { color: #0000FF } /* Literal.Number.Float */ 32 | .codehilite .mh { color: #0000FF } /* Literal.Number.Hex */ 33 | .codehilite .mi { color: #0000FF } /* Literal.Number.Integer */ 34 | .codehilite .mo { color: #0000FF } /* Literal.Number.Oct */ 35 | .codehilite .sb { color: #0000FF } /* Literal.String.Backtick */ 36 | .codehilite .sc { color: #800080 } /* Literal.String.Char */ 37 | .codehilite .sd { color: #0000FF } /* Literal.String.Doc */ 38 | .codehilite .s2 { color: #0000FF } /* Literal.String.Double */ 39 | .codehilite .se { color: #0000FF } /* Literal.String.Escape */ 40 | .codehilite .sh { color: #0000FF } /* Literal.String.Heredoc */ 41 | .codehilite .si { color: #0000FF } /* Literal.String.Interpol */ 42 | .codehilite .sx { color: #0000FF } /* Literal.String.Other */ 43 | .codehilite .sr { color: #0000FF } /* Literal.String.Regex */ 44 | .codehilite .s1 { color: #0000FF } /* Literal.String.Single */ 45 | .codehilite .ss { color: #0000FF } /* Literal.String.Symbol */ 46 | .codehilite .il { color: #0000FF } /* Literal.Number.Integer.Long */ 47 | -------------------------------------------------------------------------------- /app/static/blog/css/highlights/autumn.css: -------------------------------------------------------------------------------- 1 | .codehilite .hll { background-color: #ffffcc } 2 | .codehilite .c { color: #aaaaaa; font-style: italic } /* Comment */ 3 | .codehilite .err { color: #F00000; background-color: #F0A0A0 } /* Error */ 4 | .codehilite .k { color: #0000aa } /* Keyword */ 5 | .codehilite .cm { color: #aaaaaa; font-style: italic } /* Comment.Multiline */ 6 | .codehilite .cp { color: #4c8317 } /* Comment.Preproc */ 7 | .codehilite .c1 { color: #aaaaaa; font-style: italic } /* Comment.Single */ 8 | .codehilite .cs { color: #0000aa; font-style: italic } /* Comment.Special */ 9 | .codehilite .gd { color: #aa0000 } /* Generic.Deleted */ 10 | .codehilite .ge { font-style: italic } /* Generic.Emph */ 11 | .codehilite .gr { color: #aa0000 } /* Generic.Error */ 12 | .codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 13 | .codehilite .gi { color: #00aa00 } /* Generic.Inserted */ 14 | .codehilite .go { color: #888888 } /* Generic.Output */ 15 | .codehilite .gp { color: #555555 } /* Generic.Prompt */ 16 | .codehilite .gs { font-weight: bold } /* Generic.Strong */ 17 | .codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 18 | .codehilite .gt { color: #aa0000 } /* Generic.Traceback */ 19 | .codehilite .kc { color: #0000aa } /* Keyword.Constant */ 20 | .codehilite .kd { color: #0000aa } /* Keyword.Declaration */ 21 | .codehilite .kn { color: #0000aa } /* Keyword.Namespace */ 22 | .codehilite .kp { color: #0000aa } /* Keyword.Pseudo */ 23 | .codehilite .kr { color: #0000aa } /* Keyword.Reserved */ 24 | .codehilite .kt { color: #00aaaa } /* Keyword.Type */ 25 | .codehilite .m { color: #009999 } /* Literal.Number */ 26 | .codehilite .s { color: #aa5500 } /* Literal.String */ 27 | .codehilite .na { color: #1e90ff } /* Name.Attribute */ 28 | .codehilite .nb { color: #00aaaa } /* Name.Builtin */ 29 | .codehilite .nc { color: #00aa00; text-decoration: underline } /* Name.Class */ 30 | .codehilite .no { color: #aa0000 } /* Name.Constant */ 31 | .codehilite .nd { color: #888888 } /* Name.Decorator */ 32 | .codehilite .ni { color: #800000; font-weight: bold } /* Name.Entity */ 33 | .codehilite .nf { color: #00aa00 } /* Name.Function */ 34 | .codehilite .nn { color: #00aaaa; text-decoration: underline } /* Name.Namespace */ 35 | .codehilite .nt { color: #1e90ff; font-weight: bold } /* Name.Tag */ 36 | .codehilite .nv { color: #aa0000 } /* Name.Variable */ 37 | .codehilite .ow { color: #0000aa } /* Operator.Word */ 38 | .codehilite .w { color: #bbbbbb } /* Text.Whitespace */ 39 | .codehilite .mf { color: #009999 } /* Literal.Number.Float */ 40 | .codehilite .mh { color: #009999 } /* Literal.Number.Hex */ 41 | .codehilite .mi { color: #009999 } /* Literal.Number.Integer */ 42 | .codehilite .mo { color: #009999 } /* Literal.Number.Oct */ 43 | .codehilite .sb { color: #aa5500 } /* Literal.String.Backtick */ 44 | .codehilite .sc { color: #aa5500 } /* Literal.String.Char */ 45 | .codehilite .sd { color: #aa5500 } /* Literal.String.Doc */ 46 | .codehilite .s2 { color: #aa5500 } /* Literal.String.Double */ 47 | .codehilite .se { color: #aa5500 } /* Literal.String.Escape */ 48 | .codehilite .sh { color: #aa5500 } /* Literal.String.Heredoc */ 49 | .codehilite .si { color: #aa5500 } /* Literal.String.Interpol */ 50 | .codehilite .sx { color: #aa5500 } /* Literal.String.Other */ 51 | .codehilite .sr { color: #009999 } /* Literal.String.Regex */ 52 | .codehilite .s1 { color: #aa5500 } /* Literal.String.Single */ 53 | .codehilite .ss { color: #0000aa } /* Literal.String.Symbol */ 54 | .codehilite .bp { color: #00aaaa } /* Name.Builtin.Pseudo */ 55 | .codehilite .vc { color: #aa0000 } /* Name.Variable.Class */ 56 | .codehilite .vg { color: #aa0000 } /* Name.Variable.Global */ 57 | .codehilite .vi { color: #aa0000 } /* Name.Variable.Instance */ 58 | .codehilite .il { color: #009999 } /* Literal.Number.Integer.Long */ 59 | -------------------------------------------------------------------------------- /app/static/blog/css/highlights/perldoc.css: -------------------------------------------------------------------------------- 1 | .codehilite .hll { background-color: #ffffcc } 2 | .codehilite .c { color: #228B22 } /* Comment */ 3 | .codehilite .err { color: #a61717; background-color: #e3d2d2 } /* Error */ 4 | .codehilite .k { color: #8B008B; font-weight: bold } /* Keyword */ 5 | .codehilite .cm { color: #228B22 } /* Comment.Multiline */ 6 | .codehilite .cp { color: #1e889b } /* Comment.Preproc */ 7 | .codehilite .c1 { color: #228B22 } /* Comment.Single */ 8 | .codehilite .cs { color: #8B008B; font-weight: bold } /* Comment.Special */ 9 | .codehilite .gd { color: #aa0000 } /* Generic.Deleted */ 10 | .codehilite .ge { font-style: italic } /* Generic.Emph */ 11 | .codehilite .gr { color: #aa0000 } /* Generic.Error */ 12 | .codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 13 | .codehilite .gi { color: #00aa00 } /* Generic.Inserted */ 14 | .codehilite .go { color: #888888 } /* Generic.Output */ 15 | .codehilite .gp { color: #555555 } /* Generic.Prompt */ 16 | .codehilite .gs { font-weight: bold } /* Generic.Strong */ 17 | .codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 18 | .codehilite .gt { color: #aa0000 } /* Generic.Traceback */ 19 | .codehilite .kc { color: #8B008B; font-weight: bold } /* Keyword.Constant */ 20 | .codehilite .kd { color: #8B008B; font-weight: bold } /* Keyword.Declaration */ 21 | .codehilite .kn { color: #8B008B; font-weight: bold } /* Keyword.Namespace */ 22 | .codehilite .kp { color: #8B008B; font-weight: bold } /* Keyword.Pseudo */ 23 | .codehilite .kr { color: #8B008B; font-weight: bold } /* Keyword.Reserved */ 24 | .codehilite .kt { color: #a7a7a7; font-weight: bold } /* Keyword.Type */ 25 | .codehilite .m { color: #B452CD } /* Literal.Number */ 26 | .codehilite .s { color: #CD5555 } /* Literal.String */ 27 | .codehilite .na { color: #658b00 } /* Name.Attribute */ 28 | .codehilite .nb { color: #658b00 } /* Name.Builtin */ 29 | .codehilite .nc { color: #008b45; font-weight: bold } /* Name.Class */ 30 | .codehilite .no { color: #00688B } /* Name.Constant */ 31 | .codehilite .nd { color: #707a7c } /* Name.Decorator */ 32 | .codehilite .ne { color: #008b45; font-weight: bold } /* Name.Exception */ 33 | .codehilite .nf { color: #008b45 } /* Name.Function */ 34 | .codehilite .nn { color: #008b45; text-decoration: underline } /* Name.Namespace */ 35 | .codehilite .nt { color: #8B008B; font-weight: bold } /* Name.Tag */ 36 | .codehilite .nv { color: #00688B } /* Name.Variable */ 37 | .codehilite .ow { color: #8B008B } /* Operator.Word */ 38 | .codehilite .w { color: #bbbbbb } /* Text.Whitespace */ 39 | .codehilite .mf { color: #B452CD } /* Literal.Number.Float */ 40 | .codehilite .mh { color: #B452CD } /* Literal.Number.Hex */ 41 | .codehilite .mi { color: #B452CD } /* Literal.Number.Integer */ 42 | .codehilite .mo { color: #B452CD } /* Literal.Number.Oct */ 43 | .codehilite .sb { color: #CD5555 } /* Literal.String.Backtick */ 44 | .codehilite .sc { color: #CD5555 } /* Literal.String.Char */ 45 | .codehilite .sd { color: #CD5555 } /* Literal.String.Doc */ 46 | .codehilite .s2 { color: #CD5555 } /* Literal.String.Double */ 47 | .codehilite .se { color: #CD5555 } /* Literal.String.Escape */ 48 | .codehilite .sh { color: #1c7e71; font-style: italic } /* Literal.String.Heredoc */ 49 | .codehilite .si { color: #CD5555 } /* Literal.String.Interpol */ 50 | .codehilite .sx { color: #cb6c20 } /* Literal.String.Other */ 51 | .codehilite .sr { color: #1c7e71 } /* Literal.String.Regex */ 52 | .codehilite .s1 { color: #CD5555 } /* Literal.String.Single */ 53 | .codehilite .ss { color: #CD5555 } /* Literal.String.Symbol */ 54 | .codehilite .bp { color: #658b00 } /* Name.Builtin.Pseudo */ 55 | .codehilite .vc { color: #00688B } /* Name.Variable.Class */ 56 | .codehilite .vg { color: #00688B } /* Name.Variable.Global */ 57 | .codehilite .vi { color: #00688B } /* Name.Variable.Instance */ 58 | .codehilite .il { color: #B452CD } /* Literal.Number.Integer.Long */ 59 | -------------------------------------------------------------------------------- /app/static/blog/css/highlights/monokai.css: -------------------------------------------------------------------------------- 1 | .codehilite .hll { background-color: #49483e } 2 | .codehilite .c { color: #75715e } /* Comment */ 3 | .codehilite .err { color: #960050; background-color: #1e0010 } /* Error */ 4 | .codehilite .k { color: #66d9ef } /* Keyword */ 5 | .codehilite .l { color: #ae81ff } /* Literal */ 6 | .codehilite .n { color: #f8f8f2 } /* Name */ 7 | .codehilite .o { color: #f92672 } /* Operator */ 8 | .codehilite .p { color: #f8f8f2 } /* Punctuation */ 9 | .codehilite .cm { color: #75715e } /* Comment.Multiline */ 10 | .codehilite .cp { color: #75715e } /* Comment.Preproc */ 11 | .codehilite .c1 { color: #75715e } /* Comment.Single */ 12 | .codehilite .cs { color: #75715e } /* Comment.Special */ 13 | .codehilite .ge { font-style: italic } /* Generic.Emph */ 14 | .codehilite .gs { font-weight: bold } /* Generic.Strong */ 15 | .codehilite .kc { color: #66d9ef } /* Keyword.Constant */ 16 | .codehilite .kd { color: #66d9ef } /* Keyword.Declaration */ 17 | .codehilite .kn { color: #f92672 } /* Keyword.Namespace */ 18 | .codehilite .kp { color: #66d9ef } /* Keyword.Pseudo */ 19 | .codehilite .kr { color: #66d9ef } /* Keyword.Reserved */ 20 | .codehilite .kt { color: #66d9ef } /* Keyword.Type */ 21 | .codehilite .ld { color: #e6db74 } /* Literal.Date */ 22 | .codehilite .m { color: #ae81ff } /* Literal.Number */ 23 | .codehilite .s { color: #e6db74 } /* Literal.String */ 24 | .codehilite .na { color: #a6e22e } /* Name.Attribute */ 25 | .codehilite .nb { color: #f8f8f2 } /* Name.Builtin */ 26 | .codehilite .nc { color: #a6e22e } /* Name.Class */ 27 | .codehilite .no { color: #66d9ef } /* Name.Constant */ 28 | .codehilite .nd { color: #a6e22e } /* Name.Decorator */ 29 | .codehilite .ni { color: #f8f8f2 } /* Name.Entity */ 30 | .codehilite .ne { color: #a6e22e } /* Name.Exception */ 31 | .codehilite .nf { color: #a6e22e } /* Name.Function */ 32 | .codehilite .nl { color: #f8f8f2 } /* Name.Label */ 33 | .codehilite .nn { color: #f8f8f2 } /* Name.Namespace */ 34 | .codehilite .nx { color: #a6e22e } /* Name.Other */ 35 | .codehilite .py { color: #f8f8f2 } /* Name.Property */ 36 | .codehilite .nt { color: #f92672 } /* Name.Tag */ 37 | .codehilite .nv { color: #f8f8f2 } /* Name.Variable */ 38 | .codehilite .ow { color: #f92672 } /* Operator.Word */ 39 | .codehilite .w { color: #f8f8f2 } /* Text.Whitespace */ 40 | .codehilite .mf { color: #ae81ff } /* Literal.Number.Float */ 41 | .codehilite .mh { color: #ae81ff } /* Literal.Number.Hex */ 42 | .codehilite .mi { color: #ae81ff } /* Literal.Number.Integer */ 43 | .codehilite .mo { color: #ae81ff } /* Literal.Number.Oct */ 44 | .codehilite .sb { color: #e6db74 } /* Literal.String.Backtick */ 45 | .codehilite .sc { color: #e6db74 } /* Literal.String.Char */ 46 | .codehilite .sd { color: #e6db74 } /* Literal.String.Doc */ 47 | .codehilite .s2 { color: #e6db74 } /* Literal.String.Double */ 48 | .codehilite .se { color: #ae81ff } /* Literal.String.Escape */ 49 | .codehilite .sh { color: #e6db74 } /* Literal.String.Heredoc */ 50 | .codehilite .si { color: #e6db74 } /* Literal.String.Interpol */ 51 | .codehilite .sx { color: #e6db74 } /* Literal.String.Other */ 52 | .codehilite .sr { color: #e6db74 } /* Literal.String.Regex */ 53 | .codehilite .s1 { color: #e6db74 } /* Literal.String.Single */ 54 | .codehilite .ss { color: #e6db74 } /* Literal.String.Symbol */ 55 | .codehilite .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */ 56 | .codehilite .vc { color: #f8f8f2 } /* Name.Variable.Class */ 57 | .codehilite .vg { color: #f8f8f2 } /* Name.Variable.Global */ 58 | .codehilite .vi { color: #f8f8f2 } /* Name.Variable.Instance */ 59 | .codehilite .il { color: #ae81ff } /* Literal.Number.Integer.Long */ 60 | 61 | .codehilite .gh { } /* Generic Heading & Diff Header */ 62 | .codehilite .gu { color: #75715e; } /* Generic.Subheading & Diff Unified/Comment? */ 63 | .codehilite .gd { color: #f92672; } /* Generic.Deleted & Diff Deleted */ 64 | .codehilite .gi { color: #a6e22e; } /* Generic.Inserted & Diff Inserted */ 65 | -------------------------------------------------------------------------------- /app/static/blog/css/highlights/trac.css: -------------------------------------------------------------------------------- 1 | .codehilite .hll { background-color: #ffffcc } 2 | .codehilite .c { color: #999988; font-style: italic } /* Comment */ 3 | .codehilite .err { color: #a61717; background-color: #e3d2d2 } /* Error */ 4 | .codehilite .k { font-weight: bold } /* Keyword */ 5 | .codehilite .o { font-weight: bold } /* Operator */ 6 | .codehilite .cm { color: #999988; font-style: italic } /* Comment.Multiline */ 7 | .codehilite .cp { color: #999999; font-weight: bold } /* Comment.Preproc */ 8 | .codehilite .c1 { color: #999988; font-style: italic } /* Comment.Single */ 9 | .codehilite .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */ 10 | .codehilite .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ 11 | .codehilite .ge { font-style: italic } /* Generic.Emph */ 12 | .codehilite .gr { color: #aa0000 } /* Generic.Error */ 13 | .codehilite .gh { color: #999999 } /* Generic.Heading */ 14 | .codehilite .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ 15 | .codehilite .go { color: #888888 } /* Generic.Output */ 16 | .codehilite .gp { color: #555555 } /* Generic.Prompt */ 17 | .codehilite .gs { font-weight: bold } /* Generic.Strong */ 18 | .codehilite .gu { color: #aaaaaa } /* Generic.Subheading */ 19 | .codehilite .gt { color: #aa0000 } /* Generic.Traceback */ 20 | .codehilite .kc { font-weight: bold } /* Keyword.Constant */ 21 | .codehilite .kd { font-weight: bold } /* Keyword.Declaration */ 22 | .codehilite .kn { font-weight: bold } /* Keyword.Namespace */ 23 | .codehilite .kp { font-weight: bold } /* Keyword.Pseudo */ 24 | .codehilite .kr { font-weight: bold } /* Keyword.Reserved */ 25 | .codehilite .kt { color: #445588; font-weight: bold } /* Keyword.Type */ 26 | .codehilite .m { color: #009999 } /* Literal.Number */ 27 | .codehilite .s { color: #bb8844 } /* Literal.String */ 28 | .codehilite .na { color: #008080 } /* Name.Attribute */ 29 | .codehilite .nb { color: #999999 } /* Name.Builtin */ 30 | .codehilite .nc { color: #445588; font-weight: bold } /* Name.Class */ 31 | .codehilite .no { color: #008080 } /* Name.Constant */ 32 | .codehilite .ni { color: #800080 } /* Name.Entity */ 33 | .codehilite .ne { color: #990000; font-weight: bold } /* Name.Exception */ 34 | .codehilite .nf { color: #990000; font-weight: bold } /* Name.Function */ 35 | .codehilite .nn { color: #555555 } /* Name.Namespace */ 36 | .codehilite .nt { color: #000080 } /* Name.Tag */ 37 | .codehilite .nv { color: #008080 } /* Name.Variable */ 38 | .codehilite .ow { font-weight: bold } /* Operator.Word */ 39 | .codehilite .w { color: #bbbbbb } /* Text.Whitespace */ 40 | .codehilite .mf { color: #009999 } /* Literal.Number.Float */ 41 | .codehilite .mh { color: #009999 } /* Literal.Number.Hex */ 42 | .codehilite .mi { color: #009999 } /* Literal.Number.Integer */ 43 | .codehilite .mo { color: #009999 } /* Literal.Number.Oct */ 44 | .codehilite .sb { color: #bb8844 } /* Literal.String.Backtick */ 45 | .codehilite .sc { color: #bb8844 } /* Literal.String.Char */ 46 | .codehilite .sd { color: #bb8844 } /* Literal.String.Doc */ 47 | .codehilite .s2 { color: #bb8844 } /* Literal.String.Double */ 48 | .codehilite .se { color: #bb8844 } /* Literal.String.Escape */ 49 | .codehilite .sh { color: #bb8844 } /* Literal.String.Heredoc */ 50 | .codehilite .si { color: #bb8844 } /* Literal.String.Interpol */ 51 | .codehilite .sx { color: #bb8844 } /* Literal.String.Other */ 52 | .codehilite .sr { color: #808000 } /* Literal.String.Regex */ 53 | .codehilite .s1 { color: #bb8844 } /* Literal.String.Single */ 54 | .codehilite .ss { color: #bb8844 } /* Literal.String.Symbol */ 55 | .codehilite .bp { color: #999999 } /* Name.Builtin.Pseudo */ 56 | .codehilite .vc { color: #008080 } /* Name.Variable.Class */ 57 | .codehilite .vg { color: #008080 } /* Name.Variable.Global */ 58 | .codehilite .vi { color: #008080 } /* Name.Variable.Instance */ 59 | .codehilite .il { color: #009999 } /* Literal.Number.Integer.Long */ 60 | -------------------------------------------------------------------------------- /weixin/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from django.conf import settings 3 | import requests 4 | from app.util import FileLogger 5 | import datetime 6 | 7 | # Create your models here. 8 | 9 | # 微信数据&接口操作模型 10 | class Weixin: 11 | 12 | accessToken = None 13 | expire_at = datetime.datetime.now() 14 | 15 | # 获取用户信息 16 | @classmethod 17 | def getUserInfo(cls, openId): 18 | url = "https://api.weixin.qq.com/cgi-bin/user/info" 19 | para = { 20 | "access_token": cls.getAccessToken(), 21 | "openid": openId, 22 | "land": "zh_CN" 23 | } 24 | try: 25 | res = requests.get(url, para).json() 26 | FileLogger.log_info("user_info", res, handler_name=FileLogger.WEIXIN_HANDLER) 27 | return res 28 | except Exception as e: 29 | FileLogger.log_info("request_error", e, handler_name=FileLogger.WEIXIN_HANDLER) 30 | return None 31 | 32 | @classmethod 33 | def requestAccessToken(cls): 34 | url = "https://api.weixin.qq.com/cgi-bin/token" 35 | para = { 36 | "grant_type": "client_credential", 37 | "appid": settings.WEIXIN_APP_ID, 38 | "secret": settings.WEIXIN_APP_SECRET 39 | } 40 | try: 41 | res = requests.get(url, para).json() 42 | FileLogger.log_info("access_token", res, handler_name=FileLogger.WEIXIN_HANDLER) 43 | cls.accessToken = res["access_token"] 44 | cls.expire_at = datetime.datetime.now() + datetime.timedelta(seconds=res["expires_in"]-600) 45 | return res["access_token"] 46 | except Exception as e: 47 | FileLogger.log_info("request_error", e, handler_name=FileLogger.WEIXIN_HANDLER) 48 | return None 49 | 50 | @classmethod 51 | def getAccessToken(cls): 52 | if not cls.accessToken or cls.expire_at < datetime.datetime.now(): 53 | return cls.requestAccessToken() 54 | return cls.accessToken 55 | 56 | # 用户信息模型 57 | class User(models.Model): 58 | 59 | db_table = "user" 60 | 61 | openid = models.CharField(max_length=128, primary_key=True) 62 | nickname = models.CharField(max_length=128) 63 | sex = models.IntegerField(default=0) 64 | country = models.CharField(max_length=32) 65 | province =models.CharField(max_length=32) 66 | city = models.CharField(max_length=64) 67 | headimgurl = models.CharField(max_length=2040) 68 | subscribe_time = models.DateTimeField(default=datetime.datetime.now) 69 | created_at = models.DateTimeField(default=datetime.datetime.now) 70 | updated_at = models.DateTimeField(default=datetime.datetime.now) 71 | 72 | 73 | @staticmethod 74 | def getUser(id): 75 | try: 76 | if not id: 77 | return None 78 | return User.objects.get(openid=id) 79 | except Exception as e: 80 | return None 81 | 82 | # create & update 83 | @staticmethod 84 | def saveUser(data): 85 | try: 86 | if isinstance(data, dict): 87 | return None 88 | user = User.getUser(data.get("openid")) 89 | if not user: 90 | user = User(openid=data["openid"]) 91 | user.nickname = data.get("nickname", "") 92 | user.sex = data.get("sex", 0) 93 | user.country = data.get("country", "") 94 | user.province = data.get("province", "") 95 | user.city = data.get("city", "") 96 | user.headimgurl = data.get("headimgurl", "") 97 | user.subscribe_time = data.get("subscribe_time", datetime.datetime.now()) 98 | user.save() 99 | return user 100 | except Exception as e: 101 | return None 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /app/static/blog/css/highlights/emacs.css: -------------------------------------------------------------------------------- 1 | .codehilite .hll { background-color: #ffffcc } 2 | .codehilite .c { color: #008800; font-style: italic } /* Comment */ 3 | .codehilite .err { border: 1px solid #FF0000 } /* Error */ 4 | .codehilite .k { color: #AA22FF; font-weight: bold } /* Keyword */ 5 | .codehilite .o { color: #666666 } /* Operator */ 6 | .codehilite .cm { color: #008800; font-style: italic } /* Comment.Multiline */ 7 | .codehilite .cp { color: #008800 } /* Comment.Preproc */ 8 | .codehilite .c1 { color: #008800; font-style: italic } /* Comment.Single */ 9 | .codehilite .cs { color: #008800; font-weight: bold } /* Comment.Special */ 10 | .codehilite .gd { color: #A00000 } /* Generic.Deleted */ 11 | .codehilite .ge { font-style: italic } /* Generic.Emph */ 12 | .codehilite .gr { color: #FF0000 } /* Generic.Error */ 13 | .codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 14 | .codehilite .gi { color: #00A000 } /* Generic.Inserted */ 15 | .codehilite .go { color: #808080 } /* Generic.Output */ 16 | .codehilite .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ 17 | .codehilite .gs { font-weight: bold } /* Generic.Strong */ 18 | .codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 19 | .codehilite .gt { color: #0040D0 } /* Generic.Traceback */ 20 | .codehilite .kc { color: #AA22FF; font-weight: bold } /* Keyword.Constant */ 21 | .codehilite .kd { color: #AA22FF; font-weight: bold } /* Keyword.Declaration */ 22 | .codehilite .kn { color: #AA22FF; font-weight: bold } /* Keyword.Namespace */ 23 | .codehilite .kp { color: #AA22FF } /* Keyword.Pseudo */ 24 | .codehilite .kr { color: #AA22FF; font-weight: bold } /* Keyword.Reserved */ 25 | .codehilite .kt { color: #00BB00; font-weight: bold } /* Keyword.Type */ 26 | .codehilite .m { color: #666666 } /* Literal.Number */ 27 | .codehilite .s { color: #BB4444 } /* Literal.String */ 28 | .codehilite .na { color: #BB4444 } /* Name.Attribute */ 29 | .codehilite .nb { color: #AA22FF } /* Name.Builtin */ 30 | .codehilite .nc { color: #0000FF } /* Name.Class */ 31 | .codehilite .no { color: #880000 } /* Name.Constant */ 32 | .codehilite .nd { color: #AA22FF } /* Name.Decorator */ 33 | .codehilite .ni { color: #999999; font-weight: bold } /* Name.Entity */ 34 | .codehilite .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ 35 | .codehilite .nf { color: #00A000 } /* Name.Function */ 36 | .codehilite .nl { color: #A0A000 } /* Name.Label */ 37 | .codehilite .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ 38 | .codehilite .nt { color: #008000; font-weight: bold } /* Name.Tag */ 39 | .codehilite .nv { color: #B8860B } /* Name.Variable */ 40 | .codehilite .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ 41 | .codehilite .w { color: #bbbbbb } /* Text.Whitespace */ 42 | .codehilite .mf { color: #666666 } /* Literal.Number.Float */ 43 | .codehilite .mh { color: #666666 } /* Literal.Number.Hex */ 44 | .codehilite .mi { color: #666666 } /* Literal.Number.Integer */ 45 | .codehilite .mo { color: #666666 } /* Literal.Number.Oct */ 46 | .codehilite .sb { color: #BB4444 } /* Literal.String.Backtick */ 47 | .codehilite .sc { color: #BB4444 } /* Literal.String.Char */ 48 | .codehilite .sd { color: #BB4444; font-style: italic } /* Literal.String.Doc */ 49 | .codehilite .s2 { color: #BB4444 } /* Literal.String.Double */ 50 | .codehilite .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ 51 | .codehilite .sh { color: #BB4444 } /* Literal.String.Heredoc */ 52 | .codehilite .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ 53 | .codehilite .sx { color: #008000 } /* Literal.String.Other */ 54 | .codehilite .sr { color: #BB6688 } /* Literal.String.Regex */ 55 | .codehilite .s1 { color: #BB4444 } /* Literal.String.Single */ 56 | .codehilite .ss { color: #B8860B } /* Literal.String.Symbol */ 57 | .codehilite .bp { color: #AA22FF } /* Name.Builtin.Pseudo */ 58 | .codehilite .vc { color: #B8860B } /* Name.Variable.Class */ 59 | .codehilite .vg { color: #B8860B } /* Name.Variable.Global */ 60 | .codehilite .vi { color: #B8860B } /* Name.Variable.Instance */ 61 | .codehilite .il { color: #666666 } /* Literal.Number.Integer.Long */ 62 | -------------------------------------------------------------------------------- /app/static/blog/css/highlights/friendly.css: -------------------------------------------------------------------------------- 1 | .codehilite .hll { background-color: #ffffcc } 2 | .codehilite .c { color: #60a0b0; font-style: italic } /* Comment */ 3 | .codehilite .err { border: 1px solid #FF0000 } /* Error */ 4 | .codehilite .k { color: #007020; font-weight: bold } /* Keyword */ 5 | .codehilite .o { color: #666666 } /* Operator */ 6 | .codehilite .cm { color: #60a0b0; font-style: italic } /* Comment.Multiline */ 7 | .codehilite .cp { color: #007020 } /* Comment.Preproc */ 8 | .codehilite .c1 { color: #60a0b0; font-style: italic } /* Comment.Single */ 9 | .codehilite .cs { color: #60a0b0; background-color: #fff0f0 } /* Comment.Special */ 10 | .codehilite .gd { color: #A00000 } /* Generic.Deleted */ 11 | .codehilite .ge { font-style: italic } /* Generic.Emph */ 12 | .codehilite .gr { color: #FF0000 } /* Generic.Error */ 13 | .codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 14 | .codehilite .gi { color: #00A000 } /* Generic.Inserted */ 15 | .codehilite .go { color: #808080 } /* Generic.Output */ 16 | .codehilite .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ 17 | .codehilite .gs { font-weight: bold } /* Generic.Strong */ 18 | .codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 19 | .codehilite .gt { color: #0040D0 } /* Generic.Traceback */ 20 | .codehilite .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ 21 | .codehilite .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ 22 | .codehilite .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ 23 | .codehilite .kp { color: #007020 } /* Keyword.Pseudo */ 24 | .codehilite .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ 25 | .codehilite .kt { color: #902000 } /* Keyword.Type */ 26 | .codehilite .m { color: #40a070 } /* Literal.Number */ 27 | .codehilite .s { color: #4070a0 } /* Literal.String */ 28 | .codehilite .na { color: #4070a0 } /* Name.Attribute */ 29 | .codehilite .nb { color: #007020 } /* Name.Builtin */ 30 | .codehilite .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ 31 | .codehilite .no { color: #60add5 } /* Name.Constant */ 32 | .codehilite .nd { color: #555555; font-weight: bold } /* Name.Decorator */ 33 | .codehilite .ni { color: #d55537; font-weight: bold } /* Name.Entity */ 34 | .codehilite .ne { color: #007020 } /* Name.Exception */ 35 | .codehilite .nf { color: #06287e } /* Name.Function */ 36 | .codehilite .nl { color: #002070; font-weight: bold } /* Name.Label */ 37 | .codehilite .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ 38 | .codehilite .nt { color: #062873; font-weight: bold } /* Name.Tag */ 39 | .codehilite .nv { color: #bb60d5 } /* Name.Variable */ 40 | .codehilite .ow { color: #007020; font-weight: bold } /* Operator.Word */ 41 | .codehilite .w { color: #bbbbbb } /* Text.Whitespace */ 42 | .codehilite .mf { color: #40a070 } /* Literal.Number.Float */ 43 | .codehilite .mh { color: #40a070 } /* Literal.Number.Hex */ 44 | .codehilite .mi { color: #40a070 } /* Literal.Number.Integer */ 45 | .codehilite .mo { color: #40a070 } /* Literal.Number.Oct */ 46 | .codehilite .sb { color: #4070a0 } /* Literal.String.Backtick */ 47 | .codehilite .sc { color: #4070a0 } /* Literal.String.Char */ 48 | .codehilite .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ 49 | .codehilite .s2 { color: #4070a0 } /* Literal.String.Double */ 50 | .codehilite .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ 51 | .codehilite .sh { color: #4070a0 } /* Literal.String.Heredoc */ 52 | .codehilite .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ 53 | .codehilite .sx { color: #c65d09 } /* Literal.String.Other */ 54 | .codehilite .sr { color: #235388 } /* Literal.String.Regex */ 55 | .codehilite .s1 { color: #4070a0 } /* Literal.String.Single */ 56 | .codehilite .ss { color: #517918 } /* Literal.String.Symbol */ 57 | .codehilite .bp { color: #007020 } /* Name.Builtin.Pseudo */ 58 | .codehilite .vc { color: #bb60d5 } /* Name.Variable.Class */ 59 | .codehilite .vg { color: #bb60d5 } /* Name.Variable.Global */ 60 | .codehilite .vi { color: #bb60d5 } /* Name.Variable.Instance */ 61 | .codehilite .il { color: #40a070 } /* Literal.Number.Integer.Long */ 62 | -------------------------------------------------------------------------------- /app/static/blog/css/highlights/default.css: -------------------------------------------------------------------------------- 1 | .codehilite .hll { background-color: #ffffcc } 2 | .codehilite { background: #f8f8f8; } 3 | .codehilite .c { color: #408080; font-style: italic } /* Comment */ 4 | .codehilite .err { border: 1px solid #FF0000 } /* Error */ 5 | .codehilite .k { color: #008000; font-weight: bold } /* Keyword */ 6 | .codehilite .o { color: #666666 } /* Operator */ 7 | .codehilite .cm { color: #408080; font-style: italic } /* Comment.Multiline */ 8 | .codehilite .cp { color: #BC7A00 } /* Comment.Preproc */ 9 | .codehilite .c1 { color: #408080; font-style: italic } /* Comment.Single */ 10 | .codehilite .cs { color: #408080; font-style: italic } /* Comment.Special */ 11 | .codehilite .gd { color: #A00000 } /* Generic.Deleted */ 12 | .codehilite .ge { font-style: italic } /* Generic.Emph */ 13 | .codehilite .gr { color: #FF0000 } /* Generic.Error */ 14 | .codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 15 | .codehilite .gi { color: #00A000 } /* Generic.Inserted */ 16 | .codehilite .go { color: #808080 } /* Generic.Output */ 17 | .codehilite .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ 18 | .codehilite .gs { font-weight: bold } /* Generic.Strong */ 19 | .codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 20 | .codehilite .gt { color: #0040D0 } /* Generic.Traceback */ 21 | .codehilite .kc { color: #008000; font-weight: bold } /* Keyword.Constant */ 22 | .codehilite .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */ 23 | .codehilite .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */ 24 | .codehilite .kp { color: #008000 } /* Keyword.Pseudo */ 25 | .codehilite .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */ 26 | .codehilite .kt { color: #B00040 } /* Keyword.Type */ 27 | .codehilite .m { color: #666666 } /* Literal.Number */ 28 | .codehilite .s { color: #BA2121 } /* Literal.String */ 29 | .codehilite .na { color: #7D9029 } /* Name.Attribute */ 30 | .codehilite .nb { color: #008000 } /* Name.Builtin */ 31 | .codehilite .nc { color: #0000FF; font-weight: bold } /* Name.Class */ 32 | .codehilite .no { color: #880000 } /* Name.Constant */ 33 | .codehilite .nd { color: #AA22FF } /* Name.Decorator */ 34 | .codehilite .ni { color: #999999; font-weight: bold } /* Name.Entity */ 35 | .codehilite .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ 36 | .codehilite .nf { color: #0000FF } /* Name.Function */ 37 | .codehilite .nl { color: #A0A000 } /* Name.Label */ 38 | .codehilite .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ 39 | .codehilite .nt { color: #008000; font-weight: bold } /* Name.Tag */ 40 | .codehilite .nv { color: #19177C } /* Name.Variable */ 41 | .codehilite .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ 42 | .codehilite .w { color: #bbbbbb } /* Text.Whitespace */ 43 | .codehilite .mf { color: #666666 } /* Literal.Number.Float */ 44 | .codehilite .mh { color: #666666 } /* Literal.Number.Hex */ 45 | .codehilite .mi { color: #666666 } /* Literal.Number.Integer */ 46 | .codehilite .mo { color: #666666 } /* Literal.Number.Oct */ 47 | .codehilite .sb { color: #BA2121 } /* Literal.String.Backtick */ 48 | .codehilite .sc { color: #BA2121 } /* Literal.String.Char */ 49 | .codehilite .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */ 50 | .codehilite .s2 { color: #BA2121 } /* Literal.String.Double */ 51 | .codehilite .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ 52 | .codehilite .sh { color: #BA2121 } /* Literal.String.Heredoc */ 53 | .codehilite .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ 54 | .codehilite .sx { color: #008000 } /* Literal.String.Other */ 55 | .codehilite .sr { color: #BB6688 } /* Literal.String.Regex */ 56 | .codehilite .s1 { color: #BA2121 } /* Literal.String.Single */ 57 | .codehilite .ss { color: #19177C } /* Literal.String.Symbol */ 58 | .codehilite .bp { color: #008000 } /* Name.Builtin.Pseudo */ 59 | .codehilite .vc { color: #19177C } /* Name.Variable.Class */ 60 | .codehilite .vg { color: #19177C } /* Name.Variable.Global */ 61 | .codehilite .vi { color: #19177C } /* Name.Variable.Instance */ 62 | .codehilite .il { color: #666666 } /* Literal.Number.Integer.Long */ 63 | -------------------------------------------------------------------------------- /app/static/blog/css/highlights/github.css: -------------------------------------------------------------------------------- 1 | .codehilite .hll { background-color: #ffffcc } 2 | .codehilite .c { color: #999988; font-style: italic } /* Comment */ 3 | .codehilite .err { color: #a61717; background-color: #e3d2d2 } /* Error */ 4 | .codehilite .k { color: #000000; font-weight: bold } /* Keyword */ 5 | .codehilite .o { color: #000000; font-weight: bold } /* Operator */ 6 | .codehilite .cm { color: #999988; font-style: italic } /* Comment.Multiline */ 7 | .codehilite .cp { color: #999999; font-weight: bold; font-style: italic } /* Comment.Preproc */ 8 | .codehilite .c1 { color: #999988; font-style: italic } /* Comment.Single */ 9 | .codehilite .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */ 10 | .codehilite .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ 11 | .codehilite .ge { color: #000000; font-style: italic } /* Generic.Emph */ 12 | .codehilite .gr { color: #aa0000 } /* Generic.Error */ 13 | .codehilite .gh { color: #999999 } /* Generic.Heading */ 14 | .codehilite .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ 15 | .codehilite .go { color: #888888 } /* Generic.Output */ 16 | .codehilite .gp { color: #555555 } /* Generic.Prompt */ 17 | .codehilite .gs { font-weight: bold } /* Generic.Strong */ 18 | .codehilite .gu { color: #aaaaaa } /* Generic.Subheading */ 19 | .codehilite .gt { color: #aa0000 } /* Generic.Traceback */ 20 | .codehilite .kc { color: #000000; font-weight: bold } /* Keyword.Constant */ 21 | .codehilite .kd { color: #000000; font-weight: bold } /* Keyword.Declaration */ 22 | .codehilite .kn { color: #000000; font-weight: bold } /* Keyword.Namespace */ 23 | .codehilite .kp { color: #000000; font-weight: bold } /* Keyword.Pseudo */ 24 | .codehilite .kr { color: #000000; font-weight: bold } /* Keyword.Reserved */ 25 | .codehilite .kt { color: #445588; font-weight: bold } /* Keyword.Type */ 26 | .codehilite .m { color: #009999 } /* Literal.Number */ 27 | .codehilite .s { color: #d01040 } /* Literal.String */ 28 | .codehilite .na { color: #008080 } /* Name.Attribute */ 29 | .codehilite .nb { color: #0086B3 } /* Name.Builtin */ 30 | .codehilite .nc { color: #445588; font-weight: bold } /* Name.Class */ 31 | .codehilite .no { color: #008080 } /* Name.Constant */ 32 | .codehilite .nd { color: #3c5d5d; font-weight: bold } /* Name.Decorator */ 33 | .codehilite .ni { color: #800080 } /* Name.Entity */ 34 | .codehilite .ne { color: #990000; font-weight: bold } /* Name.Exception */ 35 | .codehilite .nf { color: #990000; font-weight: bold } /* Name.Function */ 36 | .codehilite .nl { color: #990000; font-weight: bold } /* Name.Label */ 37 | .codehilite .nn { color: #555555 } /* Name.Namespace */ 38 | .codehilite .nt { color: #000080 } /* Name.Tag */ 39 | .codehilite .nv { color: #008080 } /* Name.Variable */ 40 | .codehilite .ow { color: #000000; font-weight: bold } /* Operator.Word */ 41 | .codehilite .w { color: #bbbbbb } /* Text.Whitespace */ 42 | .codehilite .mf { color: #009999 } /* Literal.Number.Float */ 43 | .codehilite .mh { color: #009999 } /* Literal.Number.Hex */ 44 | .codehilite .mi { color: #009999 } /* Literal.Number.Integer */ 45 | .codehilite .mo { color: #009999 } /* Literal.Number.Oct */ 46 | .codehilite .sb { color: #d01040 } /* Literal.String.Backtick */ 47 | .codehilite .sc { color: #d01040 } /* Literal.String.Char */ 48 | .codehilite .sd { color: #d01040 } /* Literal.String.Doc */ 49 | .codehilite .s2 { color: #d01040 } /* Literal.String.Double */ 50 | .codehilite .se { color: #d01040 } /* Literal.String.Escape */ 51 | .codehilite .sh { color: #d01040 } /* Literal.String.Heredoc */ 52 | .codehilite .si { color: #d01040 } /* Literal.String.Interpol */ 53 | .codehilite .sx { color: #d01040 } /* Literal.String.Other */ 54 | .codehilite .sr { color: #009926 } /* Literal.String.Regex */ 55 | .codehilite .s1 { color: #d01040 } /* Literal.String.Single */ 56 | .codehilite .ss { color: #990073 } /* Literal.String.Symbol */ 57 | .codehilite .bp { color: #999999 } /* Name.Builtin.Pseudo */ 58 | .codehilite .vc { color: #008080 } /* Name.Variable.Class */ 59 | .codehilite .vg { color: #008080 } /* Name.Variable.Global */ 60 | .codehilite .vi { color: #008080 } /* Name.Variable.Instance */ 61 | .codehilite .il { color: #009999 } /* Literal.Number.Integer.Long */ 62 | -------------------------------------------------------------------------------- /app/static/blog/css/highlights/manni.css: -------------------------------------------------------------------------------- 1 | .codehilite .hll { background-color: #ffffcc } 2 | .codehilite .c { color: #0099FF; font-style: italic } /* Comment */ 3 | .codehilite .err { color: #AA0000; background-color: #FFAAAA } /* Error */ 4 | .codehilite .k { color: #006699; font-weight: bold } /* Keyword */ 5 | .codehilite .o { color: #555555 } /* Operator */ 6 | .codehilite .cm { color: #0099FF; font-style: italic } /* Comment.Multiline */ 7 | .codehilite .cp { color: #009999 } /* Comment.Preproc */ 8 | .codehilite .c1 { color: #0099FF; font-style: italic } /* Comment.Single */ 9 | .codehilite .cs { color: #0099FF; font-weight: bold; font-style: italic } /* Comment.Special */ 10 | .codehilite .gd { background-color: #FFCCCC; border: 1px solid #CC0000 } /* Generic.Deleted */ 11 | .codehilite .ge { font-style: italic } /* Generic.Emph */ 12 | .codehilite .gr { color: #FF0000 } /* Generic.Error */ 13 | .codehilite .gh { color: #003300; font-weight: bold } /* Generic.Heading */ 14 | .codehilite .gi { background-color: #CCFFCC; border: 1px solid #00CC00 } /* Generic.Inserted */ 15 | .codehilite .go { color: #AAAAAA } /* Generic.Output */ 16 | .codehilite .gp { color: #000099; font-weight: bold } /* Generic.Prompt */ 17 | .codehilite .gs { font-weight: bold } /* Generic.Strong */ 18 | .codehilite .gu { color: #003300; font-weight: bold } /* Generic.Subheading */ 19 | .codehilite .gt { color: #99CC66 } /* Generic.Traceback */ 20 | .codehilite .kc { color: #006699; font-weight: bold } /* Keyword.Constant */ 21 | .codehilite .kd { color: #006699; font-weight: bold } /* Keyword.Declaration */ 22 | .codehilite .kn { color: #006699; font-weight: bold } /* Keyword.Namespace */ 23 | .codehilite .kp { color: #006699 } /* Keyword.Pseudo */ 24 | .codehilite .kr { color: #006699; font-weight: bold } /* Keyword.Reserved */ 25 | .codehilite .kt { color: #007788; font-weight: bold } /* Keyword.Type */ 26 | .codehilite .m { color: #FF6600 } /* Literal.Number */ 27 | .codehilite .s { color: #CC3300 } /* Literal.String */ 28 | .codehilite .na { color: #330099 } /* Name.Attribute */ 29 | .codehilite .nb { color: #336666 } /* Name.Builtin */ 30 | .codehilite .nc { color: #00AA88; font-weight: bold } /* Name.Class */ 31 | .codehilite .no { color: #336600 } /* Name.Constant */ 32 | .codehilite .nd { color: #9999FF } /* Name.Decorator */ 33 | .codehilite .ni { color: #999999; font-weight: bold } /* Name.Entity */ 34 | .codehilite .ne { color: #CC0000; font-weight: bold } /* Name.Exception */ 35 | .codehilite .nf { color: #CC00FF } /* Name.Function */ 36 | .codehilite .nl { color: #9999FF } /* Name.Label */ 37 | .codehilite .nn { color: #00CCFF; font-weight: bold } /* Name.Namespace */ 38 | .codehilite .nt { color: #330099; font-weight: bold } /* Name.Tag */ 39 | .codehilite .nv { color: #003333 } /* Name.Variable */ 40 | .codehilite .ow { color: #000000; font-weight: bold } /* Operator.Word */ 41 | .codehilite .w { color: #bbbbbb } /* Text.Whitespace */ 42 | .codehilite .mf { color: #FF6600 } /* Literal.Number.Float */ 43 | .codehilite .mh { color: #FF6600 } /* Literal.Number.Hex */ 44 | .codehilite .mi { color: #FF6600 } /* Literal.Number.Integer */ 45 | .codehilite .mo { color: #FF6600 } /* Literal.Number.Oct */ 46 | .codehilite .sb { color: #CC3300 } /* Literal.String.Backtick */ 47 | .codehilite .sc { color: #CC3300 } /* Literal.String.Char */ 48 | .codehilite .sd { color: #CC3300; font-style: italic } /* Literal.String.Doc */ 49 | .codehilite .s2 { color: #CC3300 } /* Literal.String.Double */ 50 | .codehilite .se { color: #CC3300; font-weight: bold } /* Literal.String.Escape */ 51 | .codehilite .sh { color: #CC3300 } /* Literal.String.Heredoc */ 52 | .codehilite .si { color: #AA0000 } /* Literal.String.Interpol */ 53 | .codehilite .sx { color: #CC3300 } /* Literal.String.Other */ 54 | .codehilite .sr { color: #33AAAA } /* Literal.String.Regex */ 55 | .codehilite .s1 { color: #CC3300 } /* Literal.String.Single */ 56 | .codehilite .ss { color: #FFCC33 } /* Literal.String.Symbol */ 57 | .codehilite .bp { color: #336666 } /* Name.Builtin.Pseudo */ 58 | .codehilite .vc { color: #003333 } /* Name.Variable.Class */ 59 | .codehilite .vg { color: #003333 } /* Name.Variable.Global */ 60 | .codehilite .vi { color: #003333 } /* Name.Variable.Instance */ 61 | .codehilite .il { color: #FF6600 } /* Literal.Number.Integer.Long */ 62 | -------------------------------------------------------------------------------- /app/static/blog/css/highlights/vim.css: -------------------------------------------------------------------------------- 1 | .codehilite .hll { background-color: #222222 } 2 | .codehilite .c { color: #000080 } /* Comment */ 3 | .codehilite .err { color: #cccccc; border: 1px solid #FF0000 } /* Error */ 4 | .codehilite .g { color: #cccccc } /* Generic */ 5 | .codehilite .k { color: #cdcd00 } /* Keyword */ 6 | .codehilite .l { color: #cccccc } /* Literal */ 7 | .codehilite .n { color: #cccccc } /* Name */ 8 | .codehilite .o { color: #3399cc } /* Operator */ 9 | .codehilite .x { color: #cccccc } /* Other */ 10 | .codehilite .p { color: #cccccc } /* Punctuation */ 11 | .codehilite .cm { color: #000080 } /* Comment.Multiline */ 12 | .codehilite .cp { color: #000080 } /* Comment.Preproc */ 13 | .codehilite .c1 { color: #000080 } /* Comment.Single */ 14 | .codehilite .cs { color: #cd0000; font-weight: bold } /* Comment.Special */ 15 | .codehilite .gd { color: #cd0000 } /* Generic.Deleted */ 16 | .codehilite .ge { color: #cccccc; font-style: italic } /* Generic.Emph */ 17 | .codehilite .gr { color: #FF0000 } /* Generic.Error */ 18 | .codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 19 | .codehilite .gi { color: #00cd00 } /* Generic.Inserted */ 20 | .codehilite .go { color: #808080 } /* Generic.Output */ 21 | .codehilite .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ 22 | .codehilite .gs { color: #cccccc; font-weight: bold } /* Generic.Strong */ 23 | .codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 24 | .codehilite .gt { color: #0040D0 } /* Generic.Traceback */ 25 | .codehilite .kc { color: #cdcd00 } /* Keyword.Constant */ 26 | .codehilite .kd { color: #00cd00 } /* Keyword.Declaration */ 27 | .codehilite .kn { color: #cd00cd } /* Keyword.Namespace */ 28 | .codehilite .kp { color: #cdcd00 } /* Keyword.Pseudo */ 29 | .codehilite .kr { color: #cdcd00 } /* Keyword.Reserved */ 30 | .codehilite .kt { color: #00cd00 } /* Keyword.Type */ 31 | .codehilite .ld { color: #cccccc } /* Literal.Date */ 32 | .codehilite .m { color: #cd00cd } /* Literal.Number */ 33 | .codehilite .s { color: #cd0000 } /* Literal.String */ 34 | .codehilite .na { color: #cccccc } /* Name.Attribute */ 35 | .codehilite .nb { color: #cd00cd } /* Name.Builtin */ 36 | .codehilite .nc { color: #00cdcd } /* Name.Class */ 37 | .codehilite .no { color: #cccccc } /* Name.Constant */ 38 | .codehilite .nd { color: #cccccc } /* Name.Decorator */ 39 | .codehilite .ni { color: #cccccc } /* Name.Entity */ 40 | .codehilite .ne { color: #666699; font-weight: bold } /* Name.Exception */ 41 | .codehilite .nf { color: #cccccc } /* Name.Function */ 42 | .codehilite .nl { color: #cccccc } /* Name.Label */ 43 | .codehilite .nn { color: #cccccc } /* Name.Namespace */ 44 | .codehilite .nx { color: #cccccc } /* Name.Other */ 45 | .codehilite .py { color: #cccccc } /* Name.Property */ 46 | .codehilite .nt { color: #cccccc } /* Name.Tag */ 47 | .codehilite .nv { color: #00cdcd } /* Name.Variable */ 48 | .codehilite .ow { color: #cdcd00 } /* Operator.Word */ 49 | .codehilite .w { color: #cccccc } /* Text.Whitespace */ 50 | .codehilite .mf { color: #cd00cd } /* Literal.Number.Float */ 51 | .codehilite .mh { color: #cd00cd } /* Literal.Number.Hex */ 52 | .codehilite .mi { color: #cd00cd } /* Literal.Number.Integer */ 53 | .codehilite .mo { color: #cd00cd } /* Literal.Number.Oct */ 54 | .codehilite .sb { color: #cd0000 } /* Literal.String.Backtick */ 55 | .codehilite .sc { color: #cd0000 } /* Literal.String.Char */ 56 | .codehilite .sd { color: #cd0000 } /* Literal.String.Doc */ 57 | .codehilite .s2 { color: #cd0000 } /* Literal.String.Double */ 58 | .codehilite .se { color: #cd0000 } /* Literal.String.Escape */ 59 | .codehilite .sh { color: #cd0000 } /* Literal.String.Heredoc */ 60 | .codehilite .si { color: #cd0000 } /* Literal.String.Interpol */ 61 | .codehilite .sx { color: #cd0000 } /* Literal.String.Other */ 62 | .codehilite .sr { color: #cd0000 } /* Literal.String.Regex */ 63 | .codehilite .s1 { color: #cd0000 } /* Literal.String.Single */ 64 | .codehilite .ss { color: #cd0000 } /* Literal.String.Symbol */ 65 | .codehilite .bp { color: #cd00cd } /* Name.Builtin.Pseudo */ 66 | .codehilite .vc { color: #00cdcd } /* Name.Variable.Class */ 67 | .codehilite .vg { color: #00cdcd } /* Name.Variable.Global */ 68 | .codehilite .vi { color: #00cdcd } /* Name.Variable.Instance */ 69 | .codehilite .il { color: #cd00cd } /* Literal.Number.Integer.Long */ 70 | -------------------------------------------------------------------------------- /templates/blog/contact.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Black & White 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 61 |
62 | 63 |
64 |
65 |
66 |
67 |

Contact

68 |
69 |
70 |
71 |
72 |
73 | 74 | 75 | 76 | 77 | 78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 | 96 | 97 | 98 |
99 | 100 | 108 |
109 | 110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /app/static/blog/css/highlights/colorful.css: -------------------------------------------------------------------------------- 1 | .codehilite .hll { background-color: #ffffcc } 2 | .codehilite .c { color: #808080 } /* Comment */ 3 | .codehilite .err { color: #F00000; background-color: #F0A0A0 } /* Error */ 4 | .codehilite .k { color: #008000; font-weight: bold } /* Keyword */ 5 | .codehilite .o { color: #303030 } /* Operator */ 6 | .codehilite .cm { color: #808080 } /* Comment.Multiline */ 7 | .codehilite .cp { color: #507090 } /* Comment.Preproc */ 8 | .codehilite .c1 { color: #808080 } /* Comment.Single */ 9 | .codehilite .cs { color: #cc0000; font-weight: bold } /* Comment.Special */ 10 | .codehilite .gd { color: #A00000 } /* Generic.Deleted */ 11 | .codehilite .ge { font-style: italic } /* Generic.Emph */ 12 | .codehilite .gr { color: #FF0000 } /* Generic.Error */ 13 | .codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 14 | .codehilite .gi { color: #00A000 } /* Generic.Inserted */ 15 | .codehilite .go { color: #808080 } /* Generic.Output */ 16 | .codehilite .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ 17 | .codehilite .gs { font-weight: bold } /* Generic.Strong */ 18 | .codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 19 | .codehilite .gt { color: #0040D0 } /* Generic.Traceback */ 20 | .codehilite .kc { color: #008000; font-weight: bold } /* Keyword.Constant */ 21 | .codehilite .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */ 22 | .codehilite .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */ 23 | .codehilite .kp { color: #003080; font-weight: bold } /* Keyword.Pseudo */ 24 | .codehilite .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */ 25 | .codehilite .kt { color: #303090; font-weight: bold } /* Keyword.Type */ 26 | .codehilite .m { color: #6000E0; font-weight: bold } /* Literal.Number */ 27 | .codehilite .s { background-color: #fff0f0 } /* Literal.String */ 28 | .codehilite .na { color: #0000C0 } /* Name.Attribute */ 29 | .codehilite .nb { color: #007020 } /* Name.Builtin */ 30 | .codehilite .nc { color: #B00060; font-weight: bold } /* Name.Class */ 31 | .codehilite .no { color: #003060; font-weight: bold } /* Name.Constant */ 32 | .codehilite .nd { color: #505050; font-weight: bold } /* Name.Decorator */ 33 | .codehilite .ni { color: #800000; font-weight: bold } /* Name.Entity */ 34 | .codehilite .ne { color: #F00000; font-weight: bold } /* Name.Exception */ 35 | .codehilite .nf { color: #0060B0; font-weight: bold } /* Name.Function */ 36 | .codehilite .nl { color: #907000; font-weight: bold } /* Name.Label */ 37 | .codehilite .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ 38 | .codehilite .nt { color: #007000 } /* Name.Tag */ 39 | .codehilite .nv { color: #906030 } /* Name.Variable */ 40 | .codehilite .ow { color: #000000; font-weight: bold } /* Operator.Word */ 41 | .codehilite .w { color: #bbbbbb } /* Text.Whitespace */ 42 | .codehilite .mf { color: #6000E0; font-weight: bold } /* Literal.Number.Float */ 43 | .codehilite .mh { color: #005080; font-weight: bold } /* Literal.Number.Hex */ 44 | .codehilite .mi { color: #0000D0; font-weight: bold } /* Literal.Number.Integer */ 45 | .codehilite .mo { color: #4000E0; font-weight: bold } /* Literal.Number.Oct */ 46 | .codehilite .sb { background-color: #fff0f0 } /* Literal.String.Backtick */ 47 | .codehilite .sc { color: #0040D0 } /* Literal.String.Char */ 48 | .codehilite .sd { color: #D04020 } /* Literal.String.Doc */ 49 | .codehilite .s2 { background-color: #fff0f0 } /* Literal.String.Double */ 50 | .codehilite .se { color: #606060; font-weight: bold; background-color: #fff0f0 } /* Literal.String.Escape */ 51 | .codehilite .sh { background-color: #fff0f0 } /* Literal.String.Heredoc */ 52 | .codehilite .si { background-color: #e0e0e0 } /* Literal.String.Interpol */ 53 | .codehilite .sx { color: #D02000; background-color: #fff0f0 } /* Literal.String.Other */ 54 | .codehilite .sr { color: #000000; background-color: #fff0ff } /* Literal.String.Regex */ 55 | .codehilite .s1 { background-color: #fff0f0 } /* Literal.String.Single */ 56 | .codehilite .ss { color: #A06000 } /* Literal.String.Symbol */ 57 | .codehilite .bp { color: #007020 } /* Name.Builtin.Pseudo */ 58 | .codehilite .vc { color: #306090 } /* Name.Variable.Class */ 59 | .codehilite .vg { color: #d07000; font-weight: bold } /* Name.Variable.Global */ 60 | .codehilite .vi { color: #3030B0 } /* Name.Variable.Instance */ 61 | .codehilite .il { color: #0000D0; font-weight: bold } /* Literal.Number.Integer.Long */ 62 | -------------------------------------------------------------------------------- /app/static/blog/css/highlights/murphy.css: -------------------------------------------------------------------------------- 1 | .codehilite .hll { background-color: #ffffcc } 2 | .codehilite .c { color: #606060; font-style: italic } /* Comment */ 3 | .codehilite .err { color: #F00000; background-color: #F0A0A0 } /* Error */ 4 | .codehilite .k { color: #208090; font-weight: bold } /* Keyword */ 5 | .codehilite .o { color: #303030 } /* Operator */ 6 | .codehilite .cm { color: #606060; font-style: italic } /* Comment.Multiline */ 7 | .codehilite .cp { color: #507090 } /* Comment.Preproc */ 8 | .codehilite .c1 { color: #606060; font-style: italic } /* Comment.Single */ 9 | .codehilite .cs { color: #c00000; font-weight: bold; font-style: italic } /* Comment.Special */ 10 | .codehilite .gd { color: #A00000 } /* Generic.Deleted */ 11 | .codehilite .ge { font-style: italic } /* Generic.Emph */ 12 | .codehilite .gr { color: #FF0000 } /* Generic.Error */ 13 | .codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 14 | .codehilite .gi { color: #00A000 } /* Generic.Inserted */ 15 | .codehilite .go { color: #808080 } /* Generic.Output */ 16 | .codehilite .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ 17 | .codehilite .gs { font-weight: bold } /* Generic.Strong */ 18 | .codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 19 | .codehilite .gt { color: #0040D0 } /* Generic.Traceback */ 20 | .codehilite .kc { color: #208090; font-weight: bold } /* Keyword.Constant */ 21 | .codehilite .kd { color: #208090; font-weight: bold } /* Keyword.Declaration */ 22 | .codehilite .kn { color: #208090; font-weight: bold } /* Keyword.Namespace */ 23 | .codehilite .kp { color: #0080f0; font-weight: bold } /* Keyword.Pseudo */ 24 | .codehilite .kr { color: #208090; font-weight: bold } /* Keyword.Reserved */ 25 | .codehilite .kt { color: #6060f0; font-weight: bold } /* Keyword.Type */ 26 | .codehilite .m { color: #6000E0; font-weight: bold } /* Literal.Number */ 27 | .codehilite .s { background-color: #e0e0ff } /* Literal.String */ 28 | .codehilite .na { color: #000070 } /* Name.Attribute */ 29 | .codehilite .nb { color: #007020 } /* Name.Builtin */ 30 | .codehilite .nc { color: #e090e0; font-weight: bold } /* Name.Class */ 31 | .codehilite .no { color: #50e0d0; font-weight: bold } /* Name.Constant */ 32 | .codehilite .nd { color: #505050; font-weight: bold } /* Name.Decorator */ 33 | .codehilite .ni { color: #800000 } /* Name.Entity */ 34 | .codehilite .ne { color: #F00000; font-weight: bold } /* Name.Exception */ 35 | .codehilite .nf { color: #50e0d0; font-weight: bold } /* Name.Function */ 36 | .codehilite .nl { color: #907000; font-weight: bold } /* Name.Label */ 37 | .codehilite .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ 38 | .codehilite .nt { color: #007000 } /* Name.Tag */ 39 | .codehilite .nv { color: #003060 } /* Name.Variable */ 40 | .codehilite .ow { color: #000000; font-weight: bold } /* Operator.Word */ 41 | .codehilite .w { color: #bbbbbb } /* Text.Whitespace */ 42 | .codehilite .mf { color: #6000E0; font-weight: bold } /* Literal.Number.Float */ 43 | .codehilite .mh { color: #005080; font-weight: bold } /* Literal.Number.Hex */ 44 | .codehilite .mi { color: #6060f0; font-weight: bold } /* Literal.Number.Integer */ 45 | .codehilite .mo { color: #4000E0; font-weight: bold } /* Literal.Number.Oct */ 46 | .codehilite .sb { background-color: #e0e0ff } /* Literal.String.Backtick */ 47 | .codehilite .sc { color: #8080F0 } /* Literal.String.Char */ 48 | .codehilite .sd { color: #D04020 } /* Literal.String.Doc */ 49 | .codehilite .s2 { background-color: #e0e0ff } /* Literal.String.Double */ 50 | .codehilite .se { color: #606060; font-weight: bold; background-color: #e0e0ff } /* Literal.String.Escape */ 51 | .codehilite .sh { background-color: #e0e0ff } /* Literal.String.Heredoc */ 52 | .codehilite .si { background-color: #e0e0e0 } /* Literal.String.Interpol */ 53 | .codehilite .sx { color: #f08080; background-color: #e0e0ff } /* Literal.String.Other */ 54 | .codehilite .sr { color: #000000; background-color: #e0e0ff } /* Literal.String.Regex */ 55 | .codehilite .s1 { background-color: #e0e0ff } /* Literal.String.Single */ 56 | .codehilite .ss { color: #f0c080 } /* Literal.String.Symbol */ 57 | .codehilite .bp { color: #007020 } /* Name.Builtin.Pseudo */ 58 | .codehilite .vc { color: #c0c0f0 } /* Name.Variable.Class */ 59 | .codehilite .vg { color: #f08040 } /* Name.Variable.Global */ 60 | .codehilite .vi { color: #a0a0f0 } /* Name.Variable.Instance */ 61 | .codehilite .il { color: #6060f0; font-weight: bold } /* Literal.Number.Integer.Long */ 62 | -------------------------------------------------------------------------------- /app/static/blog/css/highlights/pastie.css: -------------------------------------------------------------------------------- 1 | .codehilite .hll { background-color: #ffffcc } 2 | .codehilite .c { color: #888888 } /* Comment */ 3 | .codehilite .err { color: #a61717; background-color: #e3d2d2 } /* Error */ 4 | .codehilite .k { color: #008800; font-weight: bold } /* Keyword */ 5 | .codehilite .cm { color: #888888 } /* Comment.Multiline */ 6 | .codehilite .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ 7 | .codehilite .c1 { color: #888888 } /* Comment.Single */ 8 | .codehilite .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ 9 | .codehilite .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ 10 | .codehilite .ge { font-style: italic } /* Generic.Emph */ 11 | .codehilite .gr { color: #aa0000 } /* Generic.Error */ 12 | .codehilite .gh { color: #303030 } /* Generic.Heading */ 13 | .codehilite .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ 14 | .codehilite .go { color: #888888 } /* Generic.Output */ 15 | .codehilite .gp { color: #555555 } /* Generic.Prompt */ 16 | .codehilite .gs { font-weight: bold } /* Generic.Strong */ 17 | .codehilite .gu { color: #606060 } /* Generic.Subheading */ 18 | .codehilite .gt { color: #aa0000 } /* Generic.Traceback */ 19 | .codehilite .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ 20 | .codehilite .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ 21 | .codehilite .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ 22 | .codehilite .kp { color: #008800 } /* Keyword.Pseudo */ 23 | .codehilite .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ 24 | .codehilite .kt { color: #888888; font-weight: bold } /* Keyword.Type */ 25 | .codehilite .m { color: #0000DD; font-weight: bold } /* Literal.Number */ 26 | .codehilite .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ 27 | .codehilite .na { color: #336699 } /* Name.Attribute */ 28 | .codehilite .nb { color: #003388 } /* Name.Builtin */ 29 | .codehilite .nc { color: #bb0066; font-weight: bold } /* Name.Class */ 30 | .codehilite .no { color: #003366; font-weight: bold } /* Name.Constant */ 31 | .codehilite .nd { color: #555555 } /* Name.Decorator */ 32 | .codehilite .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ 33 | .codehilite .nf { color: #0066bb; font-weight: bold } /* Name.Function */ 34 | .codehilite .nl { color: #336699; font-style: italic } /* Name.Label */ 35 | .codehilite .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ 36 | .codehilite .py { color: #336699; font-weight: bold } /* Name.Property */ 37 | .codehilite .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ 38 | .codehilite .nv { color: #336699 } /* Name.Variable */ 39 | .codehilite .ow { color: #008800 } /* Operator.Word */ 40 | .codehilite .w { color: #bbbbbb } /* Text.Whitespace */ 41 | .codehilite .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ 42 | .codehilite .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ 43 | .codehilite .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ 44 | .codehilite .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ 45 | .codehilite .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ 46 | .codehilite .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ 47 | .codehilite .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ 48 | .codehilite .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ 49 | .codehilite .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ 50 | .codehilite .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ 51 | .codehilite .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ 52 | .codehilite .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ 53 | .codehilite .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ 54 | .codehilite .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ 55 | .codehilite .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ 56 | .codehilite .bp { color: #003388 } /* Name.Builtin.Pseudo */ 57 | .codehilite .vc { color: #336699 } /* Name.Variable.Class */ 58 | .codehilite .vg { color: #dd7700 } /* Name.Variable.Global */ 59 | .codehilite .vi { color: #3333bb } /* Name.Variable.Instance */ 60 | .codehilite .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ 61 | -------------------------------------------------------------------------------- /app/static/blog/css/highlights/native.css: -------------------------------------------------------------------------------- 1 | .codehilite .hll { background-color: #404040 } 2 | .codehilite .c { color: #999999; font-style: italic } /* Comment */ 3 | .codehilite .err { color: #a61717; background-color: #e3d2d2 } /* Error */ 4 | .codehilite .g { color: #d0d0d0 } /* Generic */ 5 | .codehilite .k { color: #6ab825; font-weight: bold } /* Keyword */ 6 | .codehilite .l { color: #d0d0d0 } /* Literal */ 7 | .codehilite .n { color: #d0d0d0 } /* Name */ 8 | .codehilite .o { color: #d0d0d0 } /* Operator */ 9 | .codehilite .x { color: #d0d0d0 } /* Other */ 10 | .codehilite .p { color: #d0d0d0 } /* Punctuation */ 11 | .codehilite .cm { color: #999999; font-style: italic } /* Comment.Multiline */ 12 | .codehilite .cp { color: #cd2828; font-weight: bold } /* Comment.Preproc */ 13 | .codehilite .c1 { color: #999999; font-style: italic } /* Comment.Single */ 14 | .codehilite .cs { color: #e50808; font-weight: bold; background-color: #520000 } /* Comment.Special */ 15 | .codehilite .gd { color: #d22323 } /* Generic.Deleted */ 16 | .codehilite .ge { color: #d0d0d0; font-style: italic } /* Generic.Emph */ 17 | .codehilite .gr { color: #d22323 } /* Generic.Error */ 18 | .codehilite .gh { color: #ffffff; font-weight: bold } /* Generic.Heading */ 19 | .codehilite .gi { color: #589819 } /* Generic.Inserted */ 20 | .codehilite .go { color: #cccccc } /* Generic.Output */ 21 | .codehilite .gp { color: #aaaaaa } /* Generic.Prompt */ 22 | .codehilite .gs { color: #d0d0d0; font-weight: bold } /* Generic.Strong */ 23 | .codehilite .gu { color: #ffffff; text-decoration: underline } /* Generic.Subheading */ 24 | .codehilite .gt { color: #d22323 } /* Generic.Traceback */ 25 | .codehilite .kc { color: #6ab825; font-weight: bold } /* Keyword.Constant */ 26 | .codehilite .kd { color: #6ab825; font-weight: bold } /* Keyword.Declaration */ 27 | .codehilite .kn { color: #6ab825; font-weight: bold } /* Keyword.Namespace */ 28 | .codehilite .kp { color: #6ab825 } /* Keyword.Pseudo */ 29 | .codehilite .kr { color: #6ab825; font-weight: bold } /* Keyword.Reserved */ 30 | .codehilite .kt { color: #6ab825; font-weight: bold } /* Keyword.Type */ 31 | .codehilite .ld { color: #d0d0d0 } /* Literal.Date */ 32 | .codehilite .m { color: #3677a9 } /* Literal.Number */ 33 | .codehilite .s { color: #ed9d13 } /* Literal.String */ 34 | .codehilite .na { color: #bbbbbb } /* Name.Attribute */ 35 | .codehilite .nb { color: #24909d } /* Name.Builtin */ 36 | .codehilite .nc { color: #447fcf; text-decoration: underline } /* Name.Class */ 37 | .codehilite .no { color: #40ffff } /* Name.Constant */ 38 | .codehilite .nd { color: #ffa500 } /* Name.Decorator */ 39 | .codehilite .ni { color: #d0d0d0 } /* Name.Entity */ 40 | .codehilite .ne { color: #bbbbbb } /* Name.Exception */ 41 | .codehilite .nf { color: #447fcf } /* Name.Function */ 42 | .codehilite .nl { color: #d0d0d0 } /* Name.Label */ 43 | .codehilite .nn { color: #447fcf; text-decoration: underline } /* Name.Namespace */ 44 | .codehilite .nx { color: #d0d0d0 } /* Name.Other */ 45 | .codehilite .py { color: #d0d0d0 } /* Name.Property */ 46 | .codehilite .nt { color: #6ab825; font-weight: bold } /* Name.Tag */ 47 | .codehilite .nv { color: #40ffff } /* Name.Variable */ 48 | .codehilite .ow { color: #6ab825; font-weight: bold } /* Operator.Word */ 49 | .codehilite .w { color: #666666 } /* Text.Whitespace */ 50 | .codehilite .mf { color: #3677a9 } /* Literal.Number.Float */ 51 | .codehilite .mh { color: #3677a9 } /* Literal.Number.Hex */ 52 | .codehilite .mi { color: #3677a9 } /* Literal.Number.Integer */ 53 | .codehilite .mo { color: #3677a9 } /* Literal.Number.Oct */ 54 | .codehilite .sb { color: #ed9d13 } /* Literal.String.Backtick */ 55 | .codehilite .sc { color: #ed9d13 } /* Literal.String.Char */ 56 | .codehilite .sd { color: #ed9d13 } /* Literal.String.Doc */ 57 | .codehilite .s2 { color: #ed9d13 } /* Literal.String.Double */ 58 | .codehilite .se { color: #ed9d13 } /* Literal.String.Escape */ 59 | .codehilite .sh { color: #ed9d13 } /* Literal.String.Heredoc */ 60 | .codehilite .si { color: #ed9d13 } /* Literal.String.Interpol */ 61 | .codehilite .sx { color: #ffa500 } /* Literal.String.Other */ 62 | .codehilite .sr { color: #ed9d13 } /* Literal.String.Regex */ 63 | .codehilite .s1 { color: #ed9d13 } /* Literal.String.Single */ 64 | .codehilite .ss { color: #ed9d13 } /* Literal.String.Symbol */ 65 | .codehilite .bp { color: #24909d } /* Name.Builtin.Pseudo */ 66 | .codehilite .vc { color: #40ffff } /* Name.Variable.Class */ 67 | .codehilite .vg { color: #40ffff } /* Name.Variable.Global */ 68 | .codehilite .vi { color: #40ffff } /* Name.Variable.Instance */ 69 | .codehilite .il { color: #3677a9 } /* Literal.Number.Integer.Long */ 70 | -------------------------------------------------------------------------------- /app/util.py: -------------------------------------------------------------------------------- 1 | from datetime import datetime 2 | from django.conf import settings 3 | import logging 4 | from logging.handlers import TimedRotatingFileHandler 5 | 6 | class Date: 7 | 8 | # %Y-%m-%d 9 | @staticmethod 10 | def date(dt=None): 11 | if dt: 12 | try: 13 | return dt.strftime("%Y-%m-%d") 14 | except: 15 | return None 16 | else: 17 | return datetime.now().strftime("%Y-%m-%d") 18 | 19 | # %Y-%m-%d %H:%M:%S 20 | @staticmethod 21 | def datetime(dt=None): 22 | if dt: 23 | try: 24 | return dt.strftime("%Y-%m-%d %H:%M:%S") 25 | except: 26 | return None 27 | else: 28 | return datetime.now().strftime("%Y-%m-%d %H:%M:%S") 29 | 30 | 31 | class Auth: 32 | 33 | @staticmethod 34 | def checkOperator(request): 35 | operator = request.POST.get("operator", None) 36 | password = request.POST.get("password", None) 37 | authMap = settings.OPERATOR_AUTH 38 | if operator not in authMap: 39 | return False 40 | if authMap[operator] == password: 41 | return True 42 | return False 43 | 44 | 45 | # 文件日志 46 | class FileLogger: 47 | """ 48 | 日志文件 49 | """ 50 | 51 | # 文件日志handler名 52 | COMMON_HANDLER = "common_handler" # 通用日志 53 | WEIXIN_HANDLER = "weixin_handler" # 微信日志 54 | IMAGE_HANDLER = "image_handler" # 图片日志 55 | 56 | # 通用格式 57 | g_formatter = logging.Formatter( 58 | fmt="%(name)s - %(asctime)s - %(levelname)s : %(message)s", 59 | datefmt="%Y-%m-%d %H:%M:%S") 60 | # 日志处理器配置 61 | handler_config_dict = { 62 | COMMON_HANDLER: { 63 | 'filename': 'common.log', # 文件名 64 | 'when': 'D', # 翻转间隔类型 65 | 'interval': 7, # 翻转间隔 66 | 'backupCount': 4 # 备份数 67 | }, 68 | WEIXIN_HANDLER: { 69 | 'filename': 'weixin.log', # 文件名 70 | 'when': 'D', # 翻转间隔类型 71 | 'interval': 7, # 翻转间隔 72 | 'backupCount': 4 # 备份数 73 | }, 74 | IMAGE_HANDLER: { 75 | 'filename': 'image.log', # 文件名 76 | 'when': 'D', # 翻转间隔类型 77 | 'interval': 7, # 翻转间隔 78 | 'backupCount': 4 # 备份数 79 | }, 80 | } 81 | 82 | @classmethod 83 | def get_logger(cls, handler_name=COMMON_HANDLER): 84 | """ 85 | 根据handler名 获取不同的logger 86 | :return: 87 | """ 88 | logger = logging.getLogger(handler_name) 89 | if not logger.handlers: 90 | formatter = cls.g_formatter 91 | logger.setLevel(logging.INFO) 92 | handler_config = cls.handler_config_dict[handler_name] 93 | handler = TimedRotatingFileHandler(filename=settings.BASE_DIR + "/logs/" + handler_config['filename'], 94 | when=handler_config['when'], 95 | interval=handler_config['interval'], 96 | backupCount=handler_config['backupCount']) 97 | handler.setFormatter(formatter) 98 | handler.suffix = "%Y-%m-%d_%H-%M-%S.log" 99 | logger.addHandler(handler) 100 | return logger 101 | 102 | @classmethod 103 | def log_info(cls, log_type, message="", handler_name=COMMON_HANDLER): 104 | """ 105 | 记录日志 - info 级别 106 | :param logType: 自定义的标志字符串 - 操作类型 107 | :param message: 108 | :return: 109 | """ 110 | logger = cls.get_logger(handler_name) 111 | try: 112 | message = str(message) 113 | log_type = str(log_type) 114 | except Exception as e: 115 | message = e 116 | log_type = "logging-error" 117 | msg = " %s - %s " % (log_type, message) 118 | logger.info(msg.encode("utf8")) 119 | 120 | @staticmethod 121 | def dict2str(key_list, data_dict): 122 | """ 123 | 根据key_list 将字典转拼接成字符串 - 方便阅读 124 | :param key_list: 125 | :param data_dict: 126 | :return: 127 | """ 128 | if not isinstance(key_list, list) and not isinstance(data_dict, dict): 129 | return "" 130 | result = "" 131 | sperator = " - " 132 | for key in key_list: 133 | val = data_dict.get(key, "") 134 | result += sperator + str(key) + ":" + str(val) 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /app/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from datetime import datetime 3 | from django.urls import reverse 4 | import markdown 5 | from django.utils.html import strip_tags 6 | from app.util import Date 7 | from django.conf import settings 8 | 9 | 10 | class Category(models.Model): 11 | class Meta: 12 | db_table = "category" 13 | 14 | id = models.IntegerField(primary_key=True) 15 | name = models.CharField(max_length=128) 16 | blog_num = models.IntegerField(default=0) 17 | created_at = models.DateTimeField(default=datetime.now) 18 | updated_at = models.DateTimeField(default=datetime.now) 19 | 20 | 21 | class Blog(models.Model): 22 | class Meta: 23 | db_table = "blog" 24 | 25 | id = models.IntegerField(primary_key=True) 26 | title = models.CharField(max_length=512) 27 | content = models.TextField(default="") 28 | digest = models.TextField(default="") 29 | author = models.TextField(default="帅番茄") 30 | category_id = models.IntegerField(default=0) 31 | words_num = models.IntegerField(default=0) 32 | blog_status = models.IntegerField(default=1) 33 | view_count = models.IntegerField(default=0) 34 | created_at = models.DateTimeField(default=datetime.now) 35 | updated_at = models.DateTimeField(default=datetime.now) 36 | 37 | 38 | class BlogStatus: 39 | ON_LINE = 1 # 上线 40 | OFF_LINE = 2 # 下线 41 | 42 | def __str__(self): 43 | return self.title 44 | 45 | # 重载save方法 46 | def save(self, *args, **kwargs): 47 | # 如果没有填写摘要 48 | if not self.digest: 49 | md = markdown.Markdown(extensions=[ 50 | "markdown.extensions.extra", 51 | "markdown.extensions.codehilite", 52 | ]) 53 | self.digest = strip_tags(md.convert(self.content))[:84] + "..." 54 | super(Blog, self).save(*args, **kwargs) 55 | 56 | # 通过blogId获取博客 57 | @classmethod 58 | def getBlogById(cls, blogId): 59 | try: 60 | return Blog.objects.get(id=blogId) 61 | except: 62 | return None 63 | 64 | # 获取博客文章的url 65 | def getAbsoluteUrl(self): 66 | return reverse("detail", kwargs={"blogId": self.id}) 67 | 68 | # 获取所有的博客 69 | @classmethod 70 | def getAllBlog(cls): 71 | try: 72 | return Blog.objects.all() 73 | except: 74 | return None 75 | 76 | # 自增pv 77 | def increaseViews(self): 78 | self.view_count += 1 79 | self.save(update_fields=["view_count"]) 80 | 81 | # 获取格式化的日期 82 | def getDate(self): 83 | return Date.date(self.created_at) 84 | 85 | 86 | class BlogKeyword(models.Model): 87 | class Meta: 88 | db_table = "blog_keyword" 89 | 90 | id = models.IntegerField(primary_key=True) 91 | blog_id = models.IntegerField() 92 | keyword = models.CharField(max_length=64) 93 | created_at = models.DateTimeField(default=datetime.now) 94 | updated_at = models.DateTimeField(default=datetime.now) 95 | 96 | 97 | class UploadImage(models.Model): 98 | class Meta: 99 | db_table = "upload_image" 100 | 101 | id = models.IntegerField(primary_key=True) 102 | filename = models.CharField(max_length=252, default="") 103 | file_md5 = models.CharField(max_length=128) 104 | file_type = models.CharField(max_length=32) 105 | file_size = models.IntegerField() 106 | created_at = models.DateTimeField(default=datetime.now) 107 | updated_at = models.DateTimeField(default=datetime.now) 108 | 109 | 110 | @classmethod 111 | def getImageByMd5(cls, md5): 112 | try: 113 | return UploadImage.objects.filter(file_md5=md5).first() 114 | except Exception as e: 115 | return None 116 | 117 | # 获取本图片的url 118 | def getImageUrl(self): 119 | filename = self.file_md5 + "." + self.file_type 120 | url = settings.WEB_HOST_NAME + settings.WEB_IMAGE_SERVER_PATH + filename 121 | return url 122 | 123 | # 获取本图片在本地的位置 124 | def getImagePath(self): 125 | filename = self.file_md5 + "." + self.file_type 126 | path = settings.IMAGE_SAVING_PATH + filename 127 | return path 128 | 129 | def __str__(self): 130 | s = "filename:" + str(self.filename) + " - " + "filetype:" + str(self.file_type) \ 131 | + " - " + "filesize:" + str(self.file_size) + " - " + "filemd5:" + str(self.file_md5) 132 | return s 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /templates/base.html: -------------------------------------------------------------------------------- 1 | {% load staticfiles %} 2 | 3 | 4 | 5 | littlewulu.cn 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 63 |
64 | 65 |
66 |
67 |
68 |
69 | {% block main %} 70 | {% endblock main %} 71 |
72 | 73 | 74 | 75 | 76 |
77 |
78 |
79 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /app/static/blog/css/highlights/fruity.css: -------------------------------------------------------------------------------- 1 | .codehilite .hll { background-color: #333333 } 2 | .codehilite .c { color: #008800; font-style: italic; background-color: #0f140f } /* Comment */ 3 | .codehilite .err { color: #ffffff } /* Error */ 4 | .codehilite .g { color: #ffffff } /* Generic */ 5 | .codehilite .k { color: #fb660a; font-weight: bold } /* Keyword */ 6 | .codehilite .l { color: #ffffff } /* Literal */ 7 | .codehilite .n { color: #ffffff } /* Name */ 8 | .codehilite .o { color: #ffffff } /* Operator */ 9 | .codehilite .x { color: #ffffff } /* Other */ 10 | .codehilite .p { color: #ffffff } /* Punctuation */ 11 | .codehilite .cm { color: #008800; font-style: italic; background-color: #0f140f } /* Comment.Multiline */ 12 | .codehilite .cp { color: #ff0007; font-weight: bold; font-style: italic; background-color: #0f140f } /* Comment.Preproc */ 13 | .codehilite .c1 { color: #008800; font-style: italic; background-color: #0f140f } /* Comment.Single */ 14 | .codehilite .cs { color: #008800; font-style: italic; background-color: #0f140f } /* Comment.Special */ 15 | .codehilite .gd { color: #ffffff } /* Generic.Deleted */ 16 | .codehilite .ge { color: #ffffff } /* Generic.Emph */ 17 | .codehilite .gr { color: #ffffff } /* Generic.Error */ 18 | .codehilite .gh { color: #ffffff; font-weight: bold } /* Generic.Heading */ 19 | .codehilite .gi { color: #ffffff } /* Generic.Inserted */ 20 | .codehilite .go { color: #444444; background-color: #222222 } /* Generic.Output */ 21 | .codehilite .gp { color: #ffffff } /* Generic.Prompt */ 22 | .codehilite .gs { color: #ffffff } /* Generic.Strong */ 23 | .codehilite .gu { color: #ffffff; font-weight: bold } /* Generic.Subheading */ 24 | .codehilite .gt { color: #ffffff } /* Generic.Traceback */ 25 | .codehilite .kc { color: #fb660a; font-weight: bold } /* Keyword.Constant */ 26 | .codehilite .kd { color: #fb660a; font-weight: bold } /* Keyword.Declaration */ 27 | .codehilite .kn { color: #fb660a; font-weight: bold } /* Keyword.Namespace */ 28 | .codehilite .kp { color: #fb660a } /* Keyword.Pseudo */ 29 | .codehilite .kr { color: #fb660a; font-weight: bold } /* Keyword.Reserved */ 30 | .codehilite .kt { color: #cdcaa9; font-weight: bold } /* Keyword.Type */ 31 | .codehilite .ld { color: #ffffff } /* Literal.Date */ 32 | .codehilite .m { color: #0086f7; font-weight: bold } /* Literal.Number */ 33 | .codehilite .s { color: #0086d2 } /* Literal.String */ 34 | .codehilite .na { color: #ff0086; font-weight: bold } /* Name.Attribute */ 35 | .codehilite .nb { color: #ffffff } /* Name.Builtin */ 36 | .codehilite .nc { color: #ffffff } /* Name.Class */ 37 | .codehilite .no { color: #0086d2 } /* Name.Constant */ 38 | .codehilite .nd { color: #ffffff } /* Name.Decorator */ 39 | .codehilite .ni { color: #ffffff } /* Name.Entity */ 40 | .codehilite .ne { color: #ffffff } /* Name.Exception */ 41 | .codehilite .nf { color: #ff0086; font-weight: bold } /* Name.Function */ 42 | .codehilite .nl { color: #ffffff } /* Name.Label */ 43 | .codehilite .nn { color: #ffffff } /* Name.Namespace */ 44 | .codehilite .nx { color: #ffffff } /* Name.Other */ 45 | .codehilite .py { color: #ffffff } /* Name.Property */ 46 | .codehilite .nt { color: #fb660a; font-weight: bold } /* Name.Tag */ 47 | .codehilite .nv { color: #fb660a } /* Name.Variable */ 48 | .codehilite .ow { color: #ffffff } /* Operator.Word */ 49 | .codehilite .w { color: #888888 } /* Text.Whitespace */ 50 | .codehilite .mf { color: #0086f7; font-weight: bold } /* Literal.Number.Float */ 51 | .codehilite .mh { color: #0086f7; font-weight: bold } /* Literal.Number.Hex */ 52 | .codehilite .mi { color: #0086f7; font-weight: bold } /* Literal.Number.Integer */ 53 | .codehilite .mo { color: #0086f7; font-weight: bold } /* Literal.Number.Oct */ 54 | .codehilite .sb { color: #0086d2 } /* Literal.String.Backtick */ 55 | .codehilite .sc { color: #0086d2 } /* Literal.String.Char */ 56 | .codehilite .sd { color: #0086d2 } /* Literal.String.Doc */ 57 | .codehilite .s2 { color: #0086d2 } /* Literal.String.Double */ 58 | .codehilite .se { color: #0086d2 } /* Literal.String.Escape */ 59 | .codehilite .sh { color: #0086d2 } /* Literal.String.Heredoc */ 60 | .codehilite .si { color: #0086d2 } /* Literal.String.Interpol */ 61 | .codehilite .sx { color: #0086d2 } /* Literal.String.Other */ 62 | .codehilite .sr { color: #0086d2 } /* Literal.String.Regex */ 63 | .codehilite .s1 { color: #0086d2 } /* Literal.String.Single */ 64 | .codehilite .ss { color: #0086d2 } /* Literal.String.Symbol */ 65 | .codehilite .bp { color: #ffffff } /* Name.Builtin.Pseudo */ 66 | .codehilite .vc { color: #fb660a } /* Name.Variable.Class */ 67 | .codehilite .vg { color: #fb660a } /* Name.Variable.Global */ 68 | .codehilite .vi { color: #fb660a } /* Name.Variable.Instance */ 69 | .codehilite .il { color: #0086f7; font-weight: bold } /* Literal.Number.Integer.Long */ 70 | -------------------------------------------------------------------------------- /app/static/blog/css/highlights/tango.css: -------------------------------------------------------------------------------- 1 | .codehilite .hll { background-color: #ffffcc } 2 | .codehilite .c { color: #8f5902; font-style: italic } /* Comment */ 3 | .codehilite .err { color: #a40000; border: 1px solid #ef2929 } /* Error */ 4 | .codehilite .g { color: #000000 } /* Generic */ 5 | .codehilite .k { color: #204a87; font-weight: bold } /* Keyword */ 6 | .codehilite .l { color: #000000 } /* Literal */ 7 | .codehilite .n { color: #000000 } /* Name */ 8 | .codehilite .o { color: #ce5c00; font-weight: bold } /* Operator */ 9 | .codehilite .x { color: #000000 } /* Other */ 10 | .codehilite .p { color: #000000; font-weight: bold } /* Punctuation */ 11 | .codehilite .cm { color: #8f5902; font-style: italic } /* Comment.Multiline */ 12 | .codehilite .cp { color: #8f5902; font-style: italic } /* Comment.Preproc */ 13 | .codehilite .c1 { color: #8f5902; font-style: italic } /* Comment.Single */ 14 | .codehilite .cs { color: #8f5902; font-style: italic } /* Comment.Special */ 15 | .codehilite .gd { color: #a40000 } /* Generic.Deleted */ 16 | .codehilite .ge { color: #000000; font-style: italic } /* Generic.Emph */ 17 | .codehilite .gr { color: #ef2929 } /* Generic.Error */ 18 | .codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 19 | .codehilite .gi { color: #00A000 } /* Generic.Inserted */ 20 | .codehilite .go { color: #000000; font-style: italic } /* Generic.Output */ 21 | .codehilite .gp { color: #8f5902 } /* Generic.Prompt */ 22 | .codehilite .gs { color: #000000; font-weight: bold } /* Generic.Strong */ 23 | .codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 24 | .codehilite .gt { color: #a40000; font-weight: bold } /* Generic.Traceback */ 25 | .codehilite .kc { color: #204a87; font-weight: bold } /* Keyword.Constant */ 26 | .codehilite .kd { color: #204a87; font-weight: bold } /* Keyword.Declaration */ 27 | .codehilite .kn { color: #204a87; font-weight: bold } /* Keyword.Namespace */ 28 | .codehilite .kp { color: #204a87; font-weight: bold } /* Keyword.Pseudo */ 29 | .codehilite .kr { color: #204a87; font-weight: bold } /* Keyword.Reserved */ 30 | .codehilite .kt { color: #204a87; font-weight: bold } /* Keyword.Type */ 31 | .codehilite .ld { color: #000000 } /* Literal.Date */ 32 | .codehilite .m { color: #0000cf; font-weight: bold } /* Literal.Number */ 33 | .codehilite .s { color: #4e9a06 } /* Literal.String */ 34 | .codehilite .na { color: #c4a000 } /* Name.Attribute */ 35 | .codehilite .nb { color: #204a87 } /* Name.Builtin */ 36 | .codehilite .nc { color: #000000 } /* Name.Class */ 37 | .codehilite .no { color: #000000 } /* Name.Constant */ 38 | .codehilite .nd { color: #5c35cc; font-weight: bold } /* Name.Decorator */ 39 | .codehilite .ni { color: #ce5c00 } /* Name.Entity */ 40 | .codehilite .ne { color: #cc0000; font-weight: bold } /* Name.Exception */ 41 | .codehilite .nf { color: #000000 } /* Name.Function */ 42 | .codehilite .nl { color: #f57900 } /* Name.Label */ 43 | .codehilite .nn { color: #000000 } /* Name.Namespace */ 44 | .codehilite .nx { color: #000000 } /* Name.Other */ 45 | .codehilite .py { color: #000000 } /* Name.Property */ 46 | .codehilite .nt { color: #204a87; font-weight: bold } /* Name.Tag */ 47 | .codehilite .nv { color: #000000 } /* Name.Variable */ 48 | .codehilite .ow { color: #204a87; font-weight: bold } /* Operator.Word */ 49 | .codehilite .w { color: #f8f8f8; text-decoration: underline } /* Text.Whitespace */ 50 | .codehilite .mf { color: #0000cf; font-weight: bold } /* Literal.Number.Float */ 51 | .codehilite .mh { color: #0000cf; font-weight: bold } /* Literal.Number.Hex */ 52 | .codehilite .mi { color: #0000cf; font-weight: bold } /* Literal.Number.Integer */ 53 | .codehilite .mo { color: #0000cf; font-weight: bold } /* Literal.Number.Oct */ 54 | .codehilite .sb { color: #4e9a06 } /* Literal.String.Backtick */ 55 | .codehilite .sc { color: #4e9a06 } /* Literal.String.Char */ 56 | .codehilite .sd { color: #8f5902; font-style: italic } /* Literal.String.Doc */ 57 | .codehilite .s2 { color: #4e9a06 } /* Literal.String.Double */ 58 | .codehilite .se { color: #4e9a06 } /* Literal.String.Escape */ 59 | .codehilite .sh { color: #4e9a06 } /* Literal.String.Heredoc */ 60 | .codehilite .si { color: #4e9a06 } /* Literal.String.Interpol */ 61 | .codehilite .sx { color: #4e9a06 } /* Literal.String.Other */ 62 | .codehilite .sr { color: #4e9a06 } /* Literal.String.Regex */ 63 | .codehilite .s1 { color: #4e9a06 } /* Literal.String.Single */ 64 | .codehilite .ss { color: #4e9a06 } /* Literal.String.Symbol */ 65 | .codehilite .bp { color: #3465a4 } /* Name.Builtin.Pseudo */ 66 | .codehilite .vc { color: #000000 } /* Name.Variable.Class */ 67 | .codehilite .vg { color: #000000 } /* Name.Variable.Global */ 68 | .codehilite .vi { color: #000000 } /* Name.Variable.Instance */ 69 | .codehilite .il { color: #0000cf; font-weight: bold } /* Literal.Number.Integer.Long */ 70 | -------------------------------------------------------------------------------- /templates/blog/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Black & White 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 61 |
62 | 63 |
64 |
65 |
66 |
67 |

About Me

68 |
69 |
70 |
71 | Developer Image 72 |
73 |

Responsive web design offers us a way forward, finally allowing us to design for the ebb and flow of things. There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don’t look even slightly.

74 |

Responsive web design offers us a way forward, finally allowing us to design for the ebb and flow of things. There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don’t look even slightly.

75 |
76 |

Social

77 | 83 |
84 |
85 |
86 |
87 |
88 |
89 | 98 | 99 | 100 |
101 | 102 | 110 |
111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /app/static/blog/js/script.js: -------------------------------------------------------------------------------- 1 | var searchvisible = 0; 2 | 3 | $("#search-menu").click(function(e){ 4 | //This stops the page scrolling to the top on a # link. 5 | e.preventDefault(); 6 | 7 | var val = $('#search-icon'); 8 | if(val.hasClass('ion-ios-search-strong')){ 9 | val.addClass('ion-ios-close-empty'); 10 | val.removeClass('ion-ios-search-strong'); 11 | } 12 | else{ 13 | val.removeClass('ion-ios-close-empty'); 14 | val.addClass('ion-ios-search-strong'); 15 | } 16 | 17 | 18 | if (searchvisible ===0) { 19 | //Search is currently hidden. Slide down and show it. 20 | $("#search-form").slideDown(200); 21 | $("#s").focus(); //Set focus on the search input field. 22 | searchvisible = 1; //Set search visible flag to visible. 23 | } 24 | 25 | else { 26 | //Search is currently showing. Slide it back up and hide it. 27 | $("#search-form").slideUp(200); 28 | searchvisible = 0; 29 | } 30 | }); 31 | 32 | /*! 33 | * classie - class helper functions 34 | * from bonzo https://github.com/ded/bonzo 35 | * 36 | * classie.has( elem, 'my-class' ) -> true/false 37 | * classie.add( elem, 'my-new-class' ) 38 | * classie.remove( elem, 'my-unwanted-class' ) 39 | * classie.toggle( elem, 'my-class' ) 40 | */ 41 | 42 | /*jshint browser: true, strict: true, undef: true */ 43 | /*global define: false */ 44 | 45 | ( function( window ) { 46 | 47 | 'use strict'; 48 | 49 | // class helper functions from bonzo https://github.com/ded/bonzo 50 | 51 | function classReg( className ) { 52 | return new RegExp("(^|\\s+)" + className + "(\\s+|$)"); 53 | } 54 | 55 | // classList support for class management 56 | // altho to be fair, the api sucks because it won't accept multiple classes at once 57 | var hasClass, addClass, removeClass; 58 | 59 | if ( 'classList' in document.documentElement ) { 60 | hasClass = function( elem, c ) { 61 | return elem.classList.contains( c ); 62 | }; 63 | addClass = function( elem, c ) { 64 | elem.classList.add( c ); 65 | }; 66 | removeClass = function( elem, c ) { 67 | elem.classList.remove( c ); 68 | }; 69 | } 70 | else { 71 | hasClass = function( elem, c ) { 72 | return classReg( c ).test( elem.className ); 73 | }; 74 | addClass = function( elem, c ) { 75 | if ( !hasClass( elem, c ) ) { 76 | elem.className = elem.className + ' ' + c; 77 | } 78 | }; 79 | removeClass = function( elem, c ) { 80 | elem.className = elem.className.replace( classReg( c ), ' ' ); 81 | }; 82 | } 83 | 84 | function toggleClass( elem, c ) { 85 | var fn = hasClass( elem, c ) ? removeClass : addClass; 86 | fn( elem, c ); 87 | } 88 | 89 | var classie = { 90 | // full names 91 | hasClass: hasClass, 92 | addClass: addClass, 93 | removeClass: removeClass, 94 | toggleClass: toggleClass, 95 | // short names 96 | has: hasClass, 97 | add: addClass, 98 | remove: removeClass, 99 | toggle: toggleClass 100 | }; 101 | 102 | // transport 103 | if ( typeof define === 'function' && define.amd ) { 104 | // AMD 105 | define( classie ); 106 | } else { 107 | // browser global 108 | window.classie = classie; 109 | } 110 | 111 | })( window ); 112 | 113 | (function() { 114 | var triggerBttn = document.getElementById( 'trigger-overlay' ), 115 | overlay = document.querySelector( 'div.overlay' ), 116 | closeBttn = overlay.querySelector( 'button.overlay-close' ); 117 | transEndEventNames = { 118 | 'WebkitTransition': 'webkitTransitionEnd', 119 | 'MozTransition': 'transitionend', 120 | 'OTransition': 'oTransitionEnd', 121 | 'msTransition': 'MSTransitionEnd', 122 | 'transition': 'transitionend' 123 | }, 124 | transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ], 125 | support = { transitions : Modernizr.csstransitions }; 126 | 127 | function toggleOverlay() { 128 | if( classie.has( overlay, 'open' ) ) { 129 | classie.remove( overlay, 'open' ); 130 | classie.add( overlay, 'close' ); 131 | var onEndTransitionFn = function( ev ) { 132 | if( support.transitions ) { 133 | if( ev.propertyName !== 'visibility' ) return; 134 | this.removeEventListener( transEndEventName, onEndTransitionFn ); 135 | } 136 | classie.remove( overlay, 'close' ); 137 | }; 138 | if( support.transitions ) { 139 | overlay.addEventListener( transEndEventName, onEndTransitionFn ); 140 | } 141 | else { 142 | onEndTransitionFn(); 143 | } 144 | } 145 | else if( !classie.has( overlay, 'close' ) ) { 146 | classie.add( overlay, 'open' ); 147 | } 148 | } 149 | 150 | triggerBttn.addEventListener( 'click', toggleOverlay ); 151 | closeBttn.addEventListener( 'click', toggleOverlay ); 152 | })(); -------------------------------------------------------------------------------- /project/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for myblog project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.1.1. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/2.1/ref/settings/ 11 | """ 12 | 13 | import os 14 | from . import localsetting 15 | 16 | def getLocal(name, default=''): 17 | if hasattr(localsetting, name): 18 | return getattr(localsetting, name) 19 | else: 20 | return default 21 | 22 | 23 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 24 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 25 | 26 | 27 | # Quick-start development settings - unsuitable for production 28 | # See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/ 29 | 30 | # SECURITY WARNING: keep the secret key used in production secret! 31 | SECRET_KEY = getLocal('SECRET_KEY', '') 32 | 33 | # SECURITY WARNING: don't run with debug turned on in production! 34 | DEBUG = getLocal("DEBUG", False) 35 | 36 | ALLOWED_HOSTS = getLocal("ALLOWED_HOSTS", []) 37 | 38 | 39 | # Application definition 40 | 41 | INSTALLED_APPS = [ 42 | 'django.contrib.admin', 43 | 'django.contrib.auth', 44 | 'django.contrib.contenttypes', 45 | 'django.contrib.sessions', 46 | 'django.contrib.messages', 47 | 'django.contrib.staticfiles', 48 | 'app', 49 | 'weixin', 50 | 51 | ] 52 | 53 | MIDDLEWARE = [ 54 | 'django.middleware.security.SecurityMiddleware', 55 | 'django.contrib.sessions.middleware.SessionMiddleware', 56 | 'django.middleware.common.CommonMiddleware', 57 | # 'django.middleware.csrf.CsrfViewMiddleware', 58 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 59 | 'django.contrib.messages.middleware.MessageMiddleware', 60 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 61 | ] 62 | 63 | ROOT_URLCONF = 'project.urls' 64 | 65 | TEMPLATES = [ 66 | { 67 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 68 | 'DIRS': [os.path.join(BASE_DIR, "templates")], 69 | 'APP_DIRS': True, 70 | 'OPTIONS': { 71 | 'context_processors': [ 72 | 'django.template.context_processors.debug', 73 | 'django.template.context_processors.request', 74 | 'django.contrib.auth.context_processors.auth', 75 | 'django.contrib.messages.context_processors.messages', 76 | ], 77 | }, 78 | }, 79 | ] 80 | 81 | WSGI_APPLICATION = 'project.wsgi.application' 82 | 83 | 84 | # Database 85 | # https://docs.djangoproject.com/en/2.1/ref/settings/#databases 86 | 87 | DB_USER = getLocal("DB_USER", "root") 88 | DB_PASSWORD = getLocal("DB_PASSWORD", "root625") 89 | DB_HOST = getLocal("DB_HOST", 'localhost') 90 | DB_PORT = getLocal("DB_PORT", '3306') 91 | DB_NAME = getLocal("DB_NAME", 'wublog') 92 | DATABASES = { 93 | 'default': { 94 | 'ENGINE': 'django.db.backends.mysql', 95 | 'NAME': DB_NAME, 96 | 'USER': DB_USER, 97 | 'PASSWORD': DB_PASSWORD, 98 | 'HOST': DB_HOST, 99 | 'PORT': DB_PORT, 100 | } 101 | } 102 | 103 | 104 | # Password validation 105 | # https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators 106 | 107 | AUTH_PASSWORD_VALIDATORS = [ 108 | { 109 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 110 | }, 111 | { 112 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 113 | }, 114 | { 115 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 116 | }, 117 | { 118 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 119 | }, 120 | ] 121 | 122 | 123 | # Internationalization 124 | # https://docs.djangoproject.com/en/2.1/topics/i18n/ 125 | 126 | LANGUAGE_CODE = 'en-us' 127 | 128 | TIME_ZONE = 'UTC' 129 | 130 | USE_I18N = True 131 | 132 | USE_L10N = True 133 | 134 | USE_TZ = True 135 | 136 | 137 | # Static files (CSS, JavaScript, Images) 138 | # https://docs.djangoproject.com/en/2.1/howto/static-files/ 139 | 140 | STATIC_URL = '/static/' 141 | STATIC_ROOT = getLocal("STATIC_ROOT", os.path.join(BASE_DIR, "static")) 142 | 143 | # 简单校验 144 | OPERATOR_AUTH = getLocal("OPERATOR_AUTH", {}) 145 | 146 | 147 | # 微信服务配置 148 | WEIXIN_OPEN_TOKEN = getLocal("WEIXIN_OPEN_TOKEN", "") 149 | WEIXIN_APP_ID = getLocal("WEIXIN_APP_ID", "") 150 | WEIXIN_APP_SECRET = getLocal("WEIXIN_APP_SECRET", "") 151 | WEIXIN_ACCOUNT_ID = getLocal("WEIXIN_ACCOUNT_ID", "") 152 | 153 | YOUCLOUD_ACCOUNT_CENTER_HOST = getLocal("YOUCLOUD_ACCOUNT_CENTER_HOST", "") 154 | 155 | WEB_HOST_NAME = getLocal("WEB_HOST_NAME", "") 156 | WEB_IMAGE_SERVER_PATH = getLocal("WEB_IMAGE_SERVER_PATH", "") 157 | 158 | IMAGE_SAVING_PATH = getLocal("IMAGE_SAVING_PATH", "") 159 | IMAGE_SIZE_LIMIT = getLocal("IMAGE_SIZE_LIMIT", "") 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | -------------------------------------------------------------------------------- /app/static/blog/js/modernizr.custom.js: -------------------------------------------------------------------------------- 1 | /* Modernizr 2.7.1 (Custom Build) | MIT & BSD 2 | * Build: http://modernizr.com/download/#-csstransitions-shiv-cssclasses-prefixed-testprop-testallprops-domprefixes-load 3 | */ 4 | ;window.Modernizr=function(a,b,c){function x(a){j.cssText=a}function y(a,b){return x(prefixes.join(a+";")+(b||""))}function z(a,b){return typeof a===b}function A(a,b){return!!~(""+a).indexOf(b)}function B(a,b){for(var d in a){var e=a[d];if(!A(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function C(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:z(f,"function")?f.bind(d||b):f}return!1}function D(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+n.join(d+" ")+d).split(" ");return z(b,"string")||z(b,"undefined")?B(e,b):(e=(a+" "+o.join(d+" ")+d).split(" "),C(e,b,c))}var d="2.7.1",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m="Webkit Moz O ms",n=m.split(" "),o=m.toLowerCase().split(" "),p={},q={},r={},s=[],t=s.slice,u,v={}.hasOwnProperty,w;!z(v,"undefined")&&!z(v.call,"undefined")?w=function(a,b){return v.call(a,b)}:w=function(a,b){return b in a&&z(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=t.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(t.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(t.call(arguments)))};return e}),p.csstransitions=function(){return D("transition")};for(var E in p)w(p,E)&&(u=E.toLowerCase(),e[u]=p[E](),s.push((e[u]?"":"no-")+u));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)w(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},x(""),i=k=null,function(a,b){function l(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function m(){var a=s.elements;return typeof a=="string"?a.split(" "):a}function n(a){var b=j[a[h]];return b||(b={},i++,a[h]=i,j[i]=b),b}function o(a,c,d){c||(c=b);if(k)return c.createElement(a);d||(d=n(c));var g;return d.cache[a]?g=d.cache[a].cloneNode():f.test(a)?g=(d.cache[a]=d.createElem(a)).cloneNode():g=d.createElem(a),g.canHaveChildren&&!e.test(a)&&!g.tagUrn?d.frag.appendChild(g):g}function p(a,c){a||(a=b);if(k)return a.createDocumentFragment();c=c||n(a);var d=c.frag.cloneNode(),e=0,f=m(),g=f.length;for(;e",g="hidden"in a,k=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){g=!0,k=!0}})();var s={elements:d.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:c,shivCSS:d.shivCSS!==!1,supportsUnknownElements:k,shivMethods:d.shivMethods!==!1,type:"default",shivDocument:r,createElement:o,createDocumentFragment:p};a.html5=s,r(b)}(this,b),e._version=d,e._domPrefixes=o,e._cssomPrefixes=n,e.testProp=function(a){return B([a])},e.testAllProps=D,e.prefixed=function(a,b,c){return b?D(a,b,c):D(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+s.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f 2 | 3 | 4 | Black & White 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 61 |
62 | 63 |
64 |
65 |
66 |
67 |
68 |
69 |

70 | Adaptive Vs. Responsive Layouts And Optimal Text Readability 71 |

72 | 81 |
82 |
83 |

Responsive web design offers us a way forward, finally allowing us to design for the ebb and flow of things. There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don’t look even slightly.

84 | 87 |
88 |
89 | 90 |
91 |
92 |

93 | Adaptive Vs. Responsive Layouts And Optimal Text Readability 94 |

95 | 104 |
105 |
106 |

Responsive web design offers us a way forward, finally allowing us to design for the ebb and flow of things. There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don’t look even slightly.

107 |
108 | Continue reading 109 |
110 |
111 |
112 | 113 |
114 |
115 |

116 | Adaptive Vs. Responsive Layouts And Optimal Text Readability 117 |

118 | 127 |
128 |
129 |

Responsive web design offers us a way forward, finally allowing us to design for the ebb and flow of things. There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don’t look even slightly.

130 |
131 | Continue reading 132 |
133 |
134 |
135 | 136 |
137 |
138 |

139 | Adaptive Vs. Responsive Layouts And Optimal Text Readability 140 |

141 | 150 |
151 |
152 |

Responsive web design offers us a way forward, finally allowing us to design for the ebb and flow of things. There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don’t look even slightly.

153 |
154 | Continue reading 155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 | 167 |
168 |
169 |
170 |
171 | 172 | 173 |
174 | 175 | 183 |
184 | 185 | 186 | 187 | 188 | 189 | -------------------------------------------------------------------------------- /app/static/blog/js/pace.min.js: -------------------------------------------------------------------------------- 1 | /*! pace 0.5.6 */ 2 | (function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W=[].slice,X={}.hasOwnProperty,Y=function(a,b){function c(){this.constructor=a}for(var d in b)X.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},Z=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};for(t={catchupTime:500,initialRate:.03,minTime:500,ghostTime:500,maxProgressPerFrame:10,easeFactor:1.25,startOnPageLoad:!0,restartOnPushState:!0,restartOnRequestAfter:500,target:"body",elements:{checkInterval:100,selectors:["body"]},eventLag:{minSamples:10,sampleCount:3,lagThreshold:3},ajax:{trackMethods:["GET"],trackWebSockets:!0,ignoreURLs:[]}},B=function(){var a;return null!=(a="undefined"!=typeof performance&&null!==performance&&"function"==typeof performance.now?performance.now():void 0)?a:+new Date},D=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,s=window.cancelAnimationFrame||window.mozCancelAnimationFrame,null==D&&(D=function(a){return setTimeout(a,50)},s=function(a){return clearTimeout(a)}),F=function(a){var b,c;return b=B(),(c=function(){var d;return d=B()-b,d>=33?(b=B(),a(d,function(){return D(c)})):setTimeout(c,33-d)})()},E=function(){var a,b,c;return c=arguments[0],b=arguments[1],a=3<=arguments.length?W.call(arguments,2):[],"function"==typeof c[b]?c[b].apply(c,a):c[b]},u=function(){var a,b,c,d,e,f,g;for(b=arguments[0],d=2<=arguments.length?W.call(arguments,1):[],f=0,g=d.length;g>f;f++)if(c=d[f])for(a in c)X.call(c,a)&&(e=c[a],null!=b[a]&&"object"==typeof b[a]&&null!=e&&"object"==typeof e?u(b[a],e):b[a]=e);return b},p=function(a){var b,c,d,e,f;for(c=b=0,e=0,f=a.length;f>e;e++)d=a[e],c+=Math.abs(d),b++;return c/b},w=function(a,b){var c,d,e;if(null==a&&(a="options"),null==b&&(b=!0),e=document.querySelector("[data-pace-"+a+"]")){if(c=e.getAttribute("data-pace-"+a),!b)return c;try{return JSON.parse(c)}catch(f){return d=f,"undefined"!=typeof console&&null!==console?console.error("Error parsing inline pace options",d):void 0}}},g=function(){function a(){}return a.prototype.on=function(a,b,c,d){var e;return null==d&&(d=!1),null==this.bindings&&(this.bindings={}),null==(e=this.bindings)[a]&&(e[a]=[]),this.bindings[a].push({handler:b,ctx:c,once:d})},a.prototype.once=function(a,b,c){return this.on(a,b,c,!0)},a.prototype.off=function(a,b){var c,d,e;if(null!=(null!=(d=this.bindings)?d[a]:void 0)){if(null==b)return delete this.bindings[a];for(c=0,e=[];cP;P++)J=T[P],C[J]===!0&&(C[J]=t[J]);i=function(a){function b(){return U=b.__super__.constructor.apply(this,arguments)}return Y(b,a),b}(Error),b=function(){function a(){this.progress=0}return a.prototype.getElement=function(){var a;if(null==this.el){if(a=document.querySelector(C.target),!a)throw new i;this.el=document.createElement("div"),this.el.className="pace pace-active",document.body.className=document.body.className.replace(/pace-done/g,""),document.body.className+=" pace-running",this.el.innerHTML='
\n
\n
\n
',null!=a.firstChild?a.insertBefore(this.el,a.firstChild):a.appendChild(this.el)}return this.el},a.prototype.finish=function(){var a;return a=this.getElement(),a.className=a.className.replace("pace-active",""),a.className+=" pace-inactive",document.body.className=document.body.className.replace("pace-running",""),document.body.className+=" pace-done"},a.prototype.update=function(a){return this.progress=a,this.render()},a.prototype.destroy=function(){try{this.getElement().parentNode.removeChild(this.getElement())}catch(a){i=a}return this.el=void 0},a.prototype.render=function(){var a,b;return null==document.querySelector(C.target)?!1:(a=this.getElement(),a.children[0].style.width=""+this.progress+"%",(!this.lastRenderedProgress||this.lastRenderedProgress|0!==this.progress|0)&&(a.children[0].setAttribute("data-progress-text",""+(0|this.progress)+"%"),this.progress>=100?b="99":(b=this.progress<10?"0":"",b+=0|this.progress),a.children[0].setAttribute("data-progress",""+b)),this.lastRenderedProgress=this.progress)},a.prototype.done=function(){return this.progress>=100},a}(),h=function(){function a(){this.bindings={}}return a.prototype.trigger=function(a,b){var c,d,e,f,g;if(null!=this.bindings[a]){for(f=this.bindings[a],g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(c.call(this,b));return g}},a.prototype.on=function(a,b){var c;return null==(c=this.bindings)[a]&&(c[a]=[]),this.bindings[a].push(b)},a}(),O=window.XMLHttpRequest,N=window.XDomainRequest,M=window.WebSocket,v=function(a,b){var c,d,e,f;f=[];for(d in b.prototype)try{e=b.prototype[d],f.push(null==a[d]&&"function"!=typeof e?a[d]=e:void 0)}catch(g){c=g}return f},z=[],Pace.ignore=function(){var a,b,c;return b=arguments[0],a=2<=arguments.length?W.call(arguments,1):[],z.unshift("ignore"),c=b.apply(null,a),z.shift(),c},Pace.track=function(){var a,b,c;return b=arguments[0],a=2<=arguments.length?W.call(arguments,1):[],z.unshift("track"),c=b.apply(null,a),z.shift(),c},I=function(a){var b;if(null==a&&(a="GET"),"track"===z[0])return"force";if(!z.length&&C.ajax){if("socket"===a&&C.ajax.trackWebSockets)return!0;if(b=a.toUpperCase(),Z.call(C.ajax.trackMethods,b)>=0)return!0}return!1},j=function(a){function b(){var a,c=this;b.__super__.constructor.apply(this,arguments),a=function(a){var b;return b=a.open,a.open=function(d,e){return I(d)&&c.trigger("request",{type:d,url:e,request:a}),b.apply(a,arguments)}},window.XMLHttpRequest=function(b){var c;return c=new O(b),a(c),c};try{v(window.XMLHttpRequest,O)}catch(d){}if(null!=N){window.XDomainRequest=function(){var b;return b=new N,a(b),b};try{v(window.XDomainRequest,N)}catch(d){}}if(null!=M&&C.ajax.trackWebSockets){window.WebSocket=function(a,b){var d;return d=null!=b?new M(a,b):new M(a),I("socket")&&c.trigger("request",{type:"socket",url:a,protocols:b,request:d}),d};try{v(window.WebSocket,M)}catch(d){}}}return Y(b,a),b}(h),Q=null,x=function(){return null==Q&&(Q=new j),Q},H=function(a){var b,c,d,e;for(e=C.ajax.ignoreURLs,c=0,d=e.length;d>c;c++)if(b=e[c],"string"==typeof b){if(-1!==a.indexOf(b))return!0}else if(b.test(a))return!0;return!1},x().on("request",function(b){var c,d,e,f,g;return f=b.type,e=b.request,g=b.url,H(g)?void 0:Pace.running||C.restartOnRequestAfter===!1&&"force"!==I(f)?void 0:(d=arguments,c=C.restartOnRequestAfter||0,"boolean"==typeof c&&(c=0),setTimeout(function(){var b,c,g,h,i,j;if(b="socket"===f?e.readyState<2:0<(h=e.readyState)&&4>h){for(Pace.restart(),i=Pace.sources,j=[],c=0,g=i.length;g>c;c++){if(J=i[c],J instanceof a){J.watch.apply(J,d);break}j.push(void 0)}return j}},c))}),a=function(){function a(){var a=this;this.elements=[],x().on("request",function(){return a.watch.apply(a,arguments)})}return a.prototype.watch=function(a){var b,c,d,e;return d=a.type,b=a.request,e=a.url,H(e)?void 0:(c="socket"===d?new m(b):new n(b),this.elements.push(c))},a}(),n=function(){function a(a){var b,c,d,e,f,g,h=this;if(this.progress=0,null!=window.ProgressEvent)for(c=null,a.addEventListener("progress",function(a){return h.progress=a.lengthComputable?100*a.loaded/a.total:h.progress+(100-h.progress)/2}),g=["load","abort","timeout","error"],d=0,e=g.length;e>d;d++)b=g[d],a.addEventListener(b,function(){return h.progress=100});else f=a.onreadystatechange,a.onreadystatechange=function(){var b;return 0===(b=a.readyState)||4===b?h.progress=100:3===a.readyState&&(h.progress=50),"function"==typeof f?f.apply(null,arguments):void 0}}return a}(),m=function(){function a(a){var b,c,d,e,f=this;for(this.progress=0,e=["error","open"],c=0,d=e.length;d>c;c++)b=e[c],a.addEventListener(b,function(){return f.progress=100})}return a}(),d=function(){function a(a){var b,c,d,f;for(null==a&&(a={}),this.elements=[],null==a.selectors&&(a.selectors=[]),f=a.selectors,c=0,d=f.length;d>c;c++)b=f[c],this.elements.push(new e(b))}return a}(),e=function(){function a(a){this.selector=a,this.progress=0,this.check()}return a.prototype.check=function(){var a=this;return document.querySelector(this.selector)?this.done():setTimeout(function(){return a.check()},C.elements.checkInterval)},a.prototype.done=function(){return this.progress=100},a}(),c=function(){function a(){var a,b,c=this;this.progress=null!=(b=this.states[document.readyState])?b:100,a=document.onreadystatechange,document.onreadystatechange=function(){return null!=c.states[document.readyState]&&(c.progress=c.states[document.readyState]),"function"==typeof a?a.apply(null,arguments):void 0}}return a.prototype.states={loading:0,interactive:50,complete:100},a}(),f=function(){function a(){var a,b,c,d,e,f=this;this.progress=0,a=0,e=[],d=0,c=B(),b=setInterval(function(){var g;return g=B()-c-50,c=B(),e.push(g),e.length>C.eventLag.sampleCount&&e.shift(),a=p(e),++d>=C.eventLag.minSamples&&a=100&&(this.done=!0),b===this.last?this.sinceLastUpdate+=a:(this.sinceLastUpdate&&(this.rate=(b-this.last)/this.sinceLastUpdate),this.catchup=(b-this.progress)/C.catchupTime,this.sinceLastUpdate=0,this.last=b),b>this.progress&&(this.progress+=this.catchup*a),c=1-Math.pow(this.progress/100,C.easeFactor),this.progress+=c*this.rate*a,this.progress=Math.min(this.lastProgress+C.maxProgressPerFrame,this.progress),this.progress=Math.max(0,this.progress),this.progress=Math.min(100,this.progress),this.lastProgress=this.progress,this.progress},a}(),K=null,G=null,q=null,L=null,o=null,r=null,Pace.running=!1,y=function(){return C.restartOnPushState?Pace.restart():void 0},null!=window.history.pushState&&(S=window.history.pushState,window.history.pushState=function(){return y(),S.apply(window.history,arguments)}),null!=window.history.replaceState&&(V=window.history.replaceState,window.history.replaceState=function(){return y(),V.apply(window.history,arguments)}),k={ajax:a,elements:d,document:c,eventLag:f},(A=function(){var a,c,d,e,f,g,h,i;for(Pace.sources=K=[],g=["ajax","elements","document","eventLag"],c=0,e=g.length;e>c;c++)a=g[c],C[a]!==!1&&K.push(new k[a](C[a]));for(i=null!=(h=C.extraSources)?h:[],d=0,f=i.length;f>d;d++)J=i[d],K.push(new J(C));return Pace.bar=q=new b,G=[],L=new l})(),Pace.stop=function(){return Pace.trigger("stop"),Pace.running=!1,q.destroy(),r=!0,null!=o&&("function"==typeof s&&s(o),o=null),A()},Pace.restart=function(){return Pace.trigger("restart"),Pace.stop(),Pace.start()},Pace.go=function(){var a;return Pace.running=!0,q.render(),a=B(),r=!1,o=F(function(b,c){var d,e,f,g,h,i,j,k,m,n,o,p,s,t,u,v;for(k=100-q.progress,e=o=0,f=!0,i=p=0,t=K.length;t>p;i=++p)for(J=K[i],n=null!=G[i]?G[i]:G[i]=[],h=null!=(v=J.elements)?v:[J],j=s=0,u=h.length;u>s;j=++s)g=h[j],m=null!=n[j]?n[j]:n[j]=new l(g),f&=m.done,m.done||(e++,o+=m.tick(b));return d=o/e,q.update(L.tick(b,d)),q.done()||f||r?(q.update(100),Pace.trigger("done"),setTimeout(function(){return q.finish(),Pace.running=!1,Pace.trigger("hide")},Math.max(C.ghostTime,Math.max(C.minTime-(B()-a),0)))):c()})},Pace.start=function(a){u(C,a),Pace.running=!0;try{q.render()}catch(b){i=b}return document.querySelector(".pace")?(Pace.trigger("start"),Pace.go()):setTimeout(Pace.start,50)},"function"==typeof define&&define.amd?define(function(){return Pace}):"object"==typeof exports?module.exports=Pace:C.startOnPageLoad&&Pace.start()}).call(this); -------------------------------------------------------------------------------- /templates/blog/index_tmp.html: -------------------------------------------------------------------------------- 1 | {% load staticfiles %} 2 | 3 | 4 | 5 | Black & White 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 62 |
63 |
Collect from 网页模板
64 | 65 | 66 |
67 |
68 |
69 |
70 | 92 | 93 | 115 | 116 | 138 | 139 | 161 | 168 | 181 |
182 | 266 |
267 |
268 |
269 | 281 | 282 | 283 |
284 | 285 | 293 |
294 | 295 | 296 | 297 | 298 | 299 | -------------------------------------------------------------------------------- /templates/blog/detail_tmp.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Black & White 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 61 |
62 | 63 |
64 |
65 |
66 |
67 |
68 |
69 |

Django 博客开发入门教程:前言

70 | 78 |
79 |
80 |

Django 是使用 Python 编写的一个开源 Web 框架,可以用来快速搭建一个高性能的网站。

81 |

Django makes it easier to build better Web apps more quickly and with less 82 | code.

83 |

Django 让你以更快的速度、更少的代码、更轻松的方式搭建更好的 Web 应用。

84 |
85 |

本教程将带你使用 Django 快速开发属于自己的 Blog 网站。

86 |

教程特点

87 |

免费、中文、零基础,完整的项目,基于最新版 Django 1.10 和 Python 3.5。

88 |

带你从零开始一步步开发属于自己的博客网站,帮助你以最快的速度掌握 Django 开发的技巧。

89 |

谁适合这个教程

90 |

本教程主要面向零基础的 Django 新人。

91 |

只需要一点点 Python 语言的基础,就可以顺利阅读本教程。

92 |

如果你已有一定的 Django 开发经验,也能从本教程中学到更多的 Django 开发技巧。

93 |

在线预览

94 |

点击预览:Django Blog Demo

95 |

96 |

资源列表

97 |

项目完整代码托管在 GitHub:Django Blog Tutorial

98 |

博客前端模板托管在 GitHub:博客模板

99 |

获取帮助

100 |

在项目开发中遇到问题,即时获取帮助。

101 |

Django 学习小组 QQ 群,扫描下方二维码加入。

102 |

103 |

或者你也可以将问题的详细描述通过邮件发送至 djangostudyteam@163.com,一般会在 104 | 24 小时内答复。

105 |
106 |
107 |
108 |
109 |

发表评论

110 |
111 |
112 |
113 | 114 | 115 |
116 |
117 | 118 | 119 |
120 |
121 | 122 | 123 |
124 |
125 | 126 | 127 | 128 |
129 |
130 |
131 |
132 |

评论列表,共 4 条评论

133 |
    134 |
  • 135 | 追梦人物 136 | 137 |
    138 | 文章观点又有道理又符合人性,这才是真正为了表达观点而写,不是为了迎合某某知名人士粉丝而写。我觉得如果琼瑶是前妻,生了三孩子后被一不知名的女人挖了墙角,我不信谁会说那个女人是追求真爱,说同情琼瑶骂小三的女人都是弱者。 139 |
    140 |
  • 141 |
  • 142 | zmrenwu 143 | 144 |
    145 | 本能有可能会冲破格局,但格局有时候也会拘住本能。 146 |
    147 |
  • 148 |
  • 149 | 蝙蝠侠 150 | 151 |
    152 | 其实真理一般是属于沉默的大多数的。那些偏激的观点只能吸引那些同样偏激的人。前几年琼瑶告于妈抄袭,大家都表示大快人心,说明吃瓜观众都只是就事论事,并不是对琼瑶有偏见。 153 |
    154 |
  • 155 |
  • 156 | 长江七号 157 | 158 |
    159 | 观点我很喜欢!就是哎嘛本来一清二楚的,来个小三小四乱七八糟一团乱麻夹缠不清,简直麻烦要死 160 |
    161 |
  • 162 |
163 |
164 |
165 |
166 | 270 |
271 |
272 |
273 | 285 | 286 | 287 |
288 | 289 | 297 |
298 | 299 | 300 | 301 | 302 | 303 | -------------------------------------------------------------------------------- /app/static/blog/css/custom.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Table of Contents 3 | * 4 | * 1.0 - Google Font 5 | * 2.0 - General Elements 6 | * 3.0 - Site Header 7 | * 3.1 - Logo 8 | * 3.2 - Main Navigation 9 | * 3.2.1 - Main Nav CSS 3 Hover Effect 10 | * 4.0 - Home/Blog 11 | * 4.1 - Read More Button CSS 3 style 12 | * 5.0 - Widget 13 | * 6.0 - Footer 14 | * 7.0 - Header Search Bar 15 | * 8.0 - Mobile Menu 16 | * 9.0 - Contact Page Social 17 | * 10.0 - Contact Form 18 | * 11.0 - Media Query 19 | * 12.0 - Comment 20 | * 13.0 - Pagination 21 | */ 22 | 23 | /** 24 | * 1.0 - Google Font 25 | */ 26 | 27 | /** 28 | * 2.0 - General Elements 29 | */ 30 | 31 | * { 32 | outline: none; 33 | } 34 | 35 | h1, 36 | h2, 37 | h3, 38 | h4, 39 | h5, 40 | h6 { 41 | margin-top: 0; 42 | } 43 | 44 | b { 45 | font-weight: 400; 46 | } 47 | 48 | a { 49 | color: #333; 50 | } 51 | 52 | a:hover, a:focus { 53 | text-decoration: none; 54 | color: #000; 55 | } 56 | 57 | ::selection { 58 | background-color: #eee; 59 | } 60 | 61 | body { 62 | color: #444; 63 | font-family: 'Lato', sans-serif; 64 | } 65 | 66 | p { 67 | font-family: 'Ubuntu', sans-serif; 68 | font-weight: 400; 69 | word-spacing: 1px; 70 | letter-spacing: 0.01em; 71 | } 72 | 73 | #single p, 74 | #page p { 75 | margin-bottom: 25px; 76 | } 77 | 78 | .page-title { 79 | text-align: center; 80 | } 81 | 82 | .title { 83 | margin-bottom: 30px; 84 | } 85 | 86 | figure { 87 | margin-bottom: 25px; 88 | } 89 | 90 | img { 91 | max-width: 100%; 92 | } 93 | 94 | .img-responsive-center img { 95 | margin: 0 auto; 96 | } 97 | 98 | .height-40px { 99 | margin-bottom: 40px; 100 | } 101 | 102 | /** 103 | * 3.0 - Site Header 104 | */ 105 | 106 | #site-header { 107 | background-color: #FFF; 108 | padding: 25px 20px; 109 | margin-bottom: 40px; 110 | border-bottom: 1px solid #e7e7e7; 111 | } 112 | 113 | .copyrights { 114 | text-indent: -9999px; 115 | height: 0; 116 | line-height: 0; 117 | font-size: 0; 118 | overflow: hidden; 119 | } 120 | 121 | /** 122 | * 3.1 - Logo 123 | */ 124 | 125 | .logo h1 a { 126 | color: #000; 127 | } 128 | 129 | .logo h1 a:hover { 130 | text-decoration: none; 131 | border-bottom: none; 132 | } 133 | 134 | .logo h1 { 135 | margin: 0; 136 | font-family: 'Lato', sans-serif; 137 | font-weight: 300; 138 | } 139 | 140 | /** 141 | * 3.2 - Main Navigation 142 | */ 143 | 144 | .main-nav { 145 | margin-top: 11px; 146 | max-width: 95%; 147 | } 148 | 149 | .main-nav a { 150 | color: #000000 !important; 151 | padding: 0 0 5px 0 !important; 152 | margin-right: 30px; 153 | font-family: 'Lato', sans-serif; 154 | font-weight: 300; 155 | font-size: 24px; 156 | } 157 | 158 | .main-nav a:active, 159 | .main-nav a:focus, 160 | .main-nav a:hover { 161 | background-color: transparent !important; 162 | border-bottom: 0; 163 | } 164 | 165 | .navbar-toggle { 166 | margin: 0; 167 | border: 0; 168 | padding: 0; 169 | margin-right: 25px; 170 | } 171 | 172 | .navbar-toggle span { 173 | font-size: 2em; 174 | color: #000; 175 | } 176 | 177 | /** 178 | * 3.2.1 - Main Nav CSS 3 Hover Effect 179 | */ 180 | 181 | .cl-effect-11 a { 182 | padding: 10px 0; 183 | color: #0972b4; 184 | text-shadow: none; 185 | } 186 | 187 | .cl-effect-11 a::before { 188 | position: absolute; 189 | top: 0; 190 | left: 0; 191 | overflow: hidden; 192 | padding: 0 0 5px 0 !important; 193 | max-width: 0; 194 | border-bottom: 1px solid #000; 195 | color: #000; 196 | content: attr(data-hover); 197 | white-space: nowrap; 198 | -webkit-transition: max-width 0.5s; 199 | -moz-transition: max-width 0.5s; 200 | transition: max-width 0.5s; 201 | } 202 | 203 | .cl-effect-11 a:hover::before, 204 | .cl-effect-11 a:focus::before { 205 | max-width: 100%; 206 | } 207 | 208 | /** 209 | * 4.0 - Home/Blog 210 | */ 211 | 212 | .content-body { 213 | padding-bottom: 4em; 214 | } 215 | 216 | .post { 217 | background: #fff; 218 | padding: 30px 30px 0; 219 | } 220 | 221 | .entry-title { 222 | text-align: center; 223 | font-size: 1.9em; 224 | margin-bottom: 20px; 225 | line-height: 1.6; 226 | padding: 10px 20px 0; 227 | } 228 | 229 | .entry-meta { 230 | text-align: center; 231 | color: #DDDDDD; 232 | font-size: 13px; 233 | margin-bottom: 30px; 234 | } 235 | 236 | .entry-content { 237 | font-size: 18px; 238 | line-height: 1.9; 239 | font-weight: 300; 240 | color: #000; 241 | } 242 | 243 | .post-category::after, 244 | .post-date::after, 245 | .post-author::after, 246 | .comments-link::after { 247 | content: ' ·'; 248 | color: #000; 249 | } 250 | 251 | /** 252 | * 4.1 - Read More Button CSS 3 style 253 | */ 254 | 255 | .read-more { 256 | font-family: 'Ubuntu', sans-serif; 257 | font-weight: 400; 258 | word-spacing: 1px; 259 | letter-spacing: 0.01em; 260 | text-align: center; 261 | margin-top: 20px; 262 | } 263 | 264 | .cl-effect-14 a { 265 | padding: 0 20px; 266 | height: 45px; 267 | line-height: 45px; 268 | position: relative; 269 | display: inline-block; 270 | margin: 15px 25px; 271 | letter-spacing: 1px; 272 | font-weight: 400; 273 | text-shadow: 0 0 1px rgba(255, 255, 255, 0.3); 274 | } 275 | 276 | .cl-effect-14 a::before, 277 | .cl-effect-14 a::after { 278 | position: absolute; 279 | width: 45px; 280 | height: 1px; 281 | background: #C3C3C3; 282 | content: ''; 283 | -webkit-transition: all 0.3s; 284 | -moz-transition: all 0.3s; 285 | transition: all 0.3s; 286 | pointer-events: none; 287 | } 288 | 289 | .cl-effect-14 a::before { 290 | top: 0; 291 | left: 0; 292 | -webkit-transform: rotate(90deg); 293 | -moz-transform: rotate(90deg); 294 | transform: rotate(90deg); 295 | -webkit-transform-origin: 0 0; 296 | -moz-transform-origin: 0 0; 297 | transform-origin: 0 0; 298 | } 299 | 300 | .cl-effect-14 a::after { 301 | right: 0; 302 | bottom: 0; 303 | -webkit-transform: rotate(90deg); 304 | -moz-transform: rotate(90deg); 305 | transform: rotate(90deg); 306 | -webkit-transform-origin: 100% 0; 307 | -moz-transform-origin: 100% 0; 308 | transform-origin: 100% 0; 309 | } 310 | 311 | .cl-effect-14 a:hover::before, 312 | .cl-effect-14 a:hover::after, 313 | .cl-effect-14 a:focus::before, 314 | .cl-effect-14 a:focus::after { 315 | background: #000; 316 | } 317 | 318 | .cl-effect-14 a:hover::before, 319 | .cl-effect-14 a:focus::before { 320 | left: 50%; 321 | -webkit-transform: rotate(0deg) translateX(-50%); 322 | -moz-transform: rotate(0deg) translateX(-50%); 323 | transform: rotate(0deg) translateX(-50%); 324 | } 325 | 326 | .cl-effect-14 a:hover::after, 327 | .cl-effect-14 a:focus::after { 328 | right: 50%; 329 | -webkit-transform: rotate(0deg) translateX(50%); 330 | -moz-transform: rotate(0deg) translateX(50%); 331 | transform: rotate(0deg) translateX(50%); 332 | } 333 | 334 | /** 335 | * 5.0 - Widget 336 | */ 337 | 338 | .widget { 339 | background: #fff; 340 | padding: 30px 0 0; 341 | } 342 | 343 | .widget-title { 344 | font-size: 1.5em; 345 | margin-bottom: 20px; 346 | line-height: 1.6; 347 | padding: 10px 0 0; 348 | font-weight: 400; 349 | } 350 | 351 | .widget-recent-posts ul { 352 | padding: 0; 353 | margin: 0; 354 | padding-left: 20px; 355 | } 356 | 357 | .widget-recent-posts ul li { 358 | list-style-type: none; 359 | position: relative; 360 | line-height: 170%; 361 | margin-bottom: 10px; 362 | } 363 | 364 | .widget-recent-posts ul li::before { 365 | content: '\f3d3'; 366 | font-family: "Ionicons"; 367 | position: absolute; 368 | left: -17px; 369 | top: 3px; 370 | font-size: 16px; 371 | color: #000; 372 | } 373 | 374 | .widget-archives ul { 375 | padding: 0; 376 | margin: 0; 377 | padding-left: 25px; 378 | } 379 | 380 | .widget-archives ul li { 381 | list-style-type: none; 382 | position: relative; 383 | line-height: 170%; 384 | margin-bottom: 10px; 385 | } 386 | 387 | .widget-archives ul li::before { 388 | content: '\f3f3'; 389 | font-family: "Ionicons"; 390 | position: absolute; 391 | left: -25px; 392 | top: 1px; 393 | font-size: 16px; 394 | color: #000; 395 | } 396 | 397 | .widget-category ul { 398 | padding: 0; 399 | margin: 0; 400 | padding-left: 25px; 401 | } 402 | 403 | .widget-category ul li { 404 | list-style-type: none; 405 | position: relative; 406 | line-height: 170%; 407 | margin-bottom: 10px; 408 | } 409 | 410 | .widget-category ul li::before { 411 | content: '\f3fe'; 412 | font-family: "Ionicons"; 413 | position: absolute; 414 | left: -25px; 415 | top: 1px; 416 | font-size: 18px; 417 | color: #000; 418 | } 419 | 420 | .widget-tag-cloud ul { 421 | padding: 0; 422 | margin: 0; 423 | margin-right: -10px; 424 | } 425 | 426 | .widget-tag-cloud ul li { 427 | list-style-type: none; 428 | font-size: 13px; 429 | display: inline-block; 430 | margin-right: 10px; 431 | margin-bottom: 10px; 432 | padding: 3px 8px; 433 | border: 1px solid #ddd; 434 | } 435 | 436 | .widget-content ul ul { 437 | margin-top: 10px; 438 | } 439 | 440 | .widget-content ul li { 441 | margin-bottom: 10px; 442 | } 443 | 444 | .rss { 445 | font-size: 21px; 446 | margin-top: 30px; 447 | } 448 | 449 | .rss a { 450 | color: #444; 451 | } 452 | 453 | /** 454 | * 6.0 - Footer 455 | */ 456 | 457 | #site-footer { 458 | padding-top: 10px; 459 | padding: 0 0 1.5em 0; 460 | } 461 | 462 | .copyright { 463 | text-align: center; 464 | padding-top: 1em; 465 | margin: 0; 466 | border-top: 1px solid #eee; 467 | color: #666; 468 | } 469 | 470 | /** 471 | * 7.0 - Header Search Bar 472 | */ 473 | 474 | #header-search-box { 475 | position: absolute; 476 | right: 38px; 477 | top: 8px; 478 | } 479 | 480 | .search-form { 481 | display: none; 482 | width: 25%; 483 | position: absolute; 484 | min-width: 200px; 485 | right: -6px; 486 | top: 33px; 487 | } 488 | 489 | #search-menu span { 490 | font-size: 20px; 491 | } 492 | 493 | #searchform { 494 | position: relative; 495 | border: 1px solid #ddd; 496 | min-height: 42px; 497 | } 498 | 499 | #searchform input[type=search] { 500 | width: 100%; 501 | border: none; 502 | position: absolute; 503 | left: 0; 504 | padding: 10px 30px 10px 10px; 505 | z-index: 99; 506 | } 507 | 508 | #searchform button { 509 | position: absolute; 510 | right: 6px; 511 | top: 4px; 512 | z-index: 999; 513 | background: transparent; 514 | border: 0; 515 | padding: 0; 516 | } 517 | 518 | #searchform button span { 519 | font-size: 22px; 520 | } 521 | 522 | #search-menu span.ion-ios-close-empty { 523 | font-size: 40px; 524 | line-height: 0; 525 | position: relative; 526 | top: -6px; 527 | } 528 | 529 | /** 530 | * 8.0 - Mobile Menu 531 | */ 532 | 533 | .overlay { 534 | position: fixed; 535 | width: 100%; 536 | height: 100%; 537 | top: 0; 538 | left: 0; 539 | background: #fff; 540 | } 541 | 542 | .overlay .overlay-close { 543 | position: absolute; 544 | right: 25px; 545 | top: 10px; 546 | padding: 0; 547 | overflow: hidden; 548 | border: none; 549 | color: transparent; 550 | background-color: transparent; 551 | z-index: 100; 552 | } 553 | 554 | .overlay-hugeinc.open .ion-ios-close-empty { 555 | color: #000; 556 | font-size: 50px; 557 | } 558 | 559 | .overlay nav { 560 | text-align: center; 561 | position: relative; 562 | top: 50%; 563 | height: 60%; 564 | font-size: 54px; 565 | -webkit-transform: translateY(-50%); 566 | transform: translateY(-50%); 567 | } 568 | 569 | .overlay ul { 570 | list-style: none; 571 | padding: 0; 572 | margin: 0 auto; 573 | display: inline-block; 574 | height: 100%; 575 | position: relative; 576 | } 577 | 578 | .overlay ul li { 579 | display: block; 580 | height: 20%; 581 | height: calc(100% / 5); 582 | min-height: 54px; 583 | } 584 | 585 | .overlay ul li a { 586 | font-weight: 300; 587 | display: block; 588 | -webkit-transition: color 0.2s; 589 | transition: color 0.2s; 590 | } 591 | 592 | .overlay ul li a:hover, 593 | .overlay ul li a:focus { 594 | color: #000; 595 | } 596 | 597 | .overlay-hugeinc { 598 | opacity: 0; 599 | visibility: hidden; 600 | -webkit-transition: opacity 0.5s, visibility 0s 0.5s; 601 | transition: opacity 0.5s, visibility 0s 0.5s; 602 | } 603 | 604 | .overlay-hugeinc.open { 605 | opacity: 1; 606 | visibility: visible; 607 | -webkit-transition: opacity 0.5s; 608 | transition: opacity 0.5s; 609 | } 610 | 611 | .overlay-hugeinc nav { 612 | -webkit-perspective: 1200px; 613 | perspective: 1200px; 614 | } 615 | 616 | .overlay-hugeinc nav ul { 617 | opacity: 0.4; 618 | -webkit-transform: translateY(-25%) rotateX(35deg); 619 | transform: translateY(-25%) rotateX(35deg); 620 | -webkit-transition: -webkit-transform 0.5s, opacity 0.5s; 621 | transition: transform 0.5s, opacity 0.5s; 622 | } 623 | 624 | .overlay-hugeinc.open nav ul { 625 | opacity: 1; 626 | -webkit-transform: rotateX(0deg); 627 | transform: rotateX(0deg); 628 | } 629 | 630 | .overlay-hugeinc.close nav ul { 631 | -webkit-transform: translateY(25%) rotateX(-35deg); 632 | transform: translateY(25%) rotateX(-35deg); 633 | } 634 | 635 | /** 636 | * 9.0 - Contact Page Social 637 | */ 638 | 639 | .social { 640 | list-style-type: none; 641 | padding: 0; 642 | margin: 0; 643 | text-align: center; 644 | } 645 | 646 | .social li { 647 | display: inline-block; 648 | margin-right: 10px; 649 | margin-bottom: 20px; 650 | } 651 | 652 | .social li a { 653 | border: 1px solid #888; 654 | font-size: 22px; 655 | color: #888; 656 | transition: all 0.3s ease-in; 657 | } 658 | 659 | .social li a:hover { 660 | background-color: #333; 661 | color: #fff; 662 | } 663 | 664 | .facebook a { 665 | padding: 12px 21px; 666 | } 667 | 668 | .twitter a { 669 | padding: 12px 15px; 670 | } 671 | 672 | .google-plus a { 673 | padding: 12px 15px; 674 | } 675 | 676 | .tumblr a { 677 | padding: 12px 20px; 678 | } 679 | 680 | /** 681 | * 10.0 - Contact Form 682 | */ 683 | 684 | .contact-form input, .comment-form input { 685 | border: 1px solid #aaa; 686 | margin-bottom: 15px; 687 | width: 100%; 688 | padding: 15px 15px; 689 | font-size: 16px; 690 | line-height: 100%; 691 | transition: 0.4s border-color linear; 692 | } 693 | 694 | .contact-form textarea, .comment-form textarea { 695 | border: 1px solid #aaa; 696 | margin-bottom: 15px; 697 | width: 100%; 698 | padding: 15px 15px; 699 | font-size: 16px; 700 | line-height: 20px !important; 701 | min-height: 183px; 702 | transition: 0.4s border-color linear; 703 | } 704 | 705 | .contact-form input:focus, .comment-form input:focus, 706 | .contact-form textarea:focus, .comment-form textarea:focus { 707 | border-color: #666; 708 | } 709 | 710 | .btn-send { 711 | background: none; 712 | border: 1px solid #aaa; 713 | cursor: pointer; 714 | padding: 25px 80px; 715 | display: inline-block; 716 | letter-spacing: 1px; 717 | position: relative; 718 | transition: all 0.3s; 719 | } 720 | 721 | .btn-5 { 722 | color: #666; 723 | height: 70px; 724 | min-width: 260px; 725 | line-height: 15px; 726 | font-size: 16px; 727 | overflow: hidden; 728 | -webkit-backface-visibility: hidden; 729 | -moz-backface-visibility: hidden; 730 | backface-visibility: hidden; 731 | } 732 | 733 | .btn-5 span { 734 | display: inline-block; 735 | width: 100%; 736 | height: 100%; 737 | -webkit-transition: all 0.3s; 738 | -webkit-backface-visibility: hidden; 739 | -moz-transition: all 0.3s; 740 | -moz-backface-visibility: hidden; 741 | transition: all 0.3s; 742 | backface-visibility: hidden; 743 | } 744 | 745 | .btn-5:before { 746 | position: absolute; 747 | height: 100%; 748 | width: 100%; 749 | line-height: 2.5; 750 | font-size: 180%; 751 | -webkit-transition: all 0.3s; 752 | -moz-transition: all 0.3s; 753 | transition: all 0.3s; 754 | } 755 | 756 | .btn-5:active:before { 757 | color: #703b87; 758 | } 759 | 760 | .btn-5b:hover span { 761 | -webkit-transform: translateX(200%); 762 | -moz-transform: translateX(200%); 763 | -ms-transform: translateX(200%); 764 | transform: translateX(200%); 765 | } 766 | 767 | .btn-5b:before { 768 | left: -100%; 769 | top: 0; 770 | } 771 | 772 | .btn-5b:hover:before { 773 | left: 0; 774 | } 775 | 776 | /** 777 | * 11.0 - Media Query 778 | */ 779 | 780 | @media (max-width: 991px) { 781 | .main-nav a { 782 | margin-right: 20px; 783 | } 784 | 785 | #header-search-box { 786 | position: absolute; 787 | right: 20px; 788 | } 789 | } 790 | 791 | @media (max-width: 767px) { 792 | #header-search-box { 793 | right: 20px; 794 | top: 9px; 795 | } 796 | 797 | .main-nav { 798 | margin-top: 2px; 799 | } 800 | 801 | .btn-5 span { 802 | display: none; 803 | } 804 | 805 | .btn-5b:before { 806 | left: 0; 807 | } 808 | } 809 | 810 | @media (max-width: 431px) { 811 | .logo h1 { 812 | margin-top: 8px; 813 | font-size: 24px; 814 | } 815 | 816 | .post { 817 | background: #fff; 818 | padding: 0 10px 0; 819 | } 820 | 821 | .more-link { 822 | font-size: 0.9em; 823 | line-height: 100%; 824 | } 825 | } 826 | 827 | @media screen and (max-height: 30.5em) { 828 | .overlay nav { 829 | height: 70%; 830 | font-size: 34px; 831 | } 832 | 833 | .overlay ul li { 834 | min-height: 34px; 835 | } 836 | } 837 | 838 | /** 839 | * 12.0 - Comment 840 | */ 841 | .comment-area { 842 | padding: 0 30px 0; 843 | } 844 | 845 | .comment-form { 846 | margin-top: 15px; 847 | } 848 | 849 | .comment-form .comment-btn { 850 | background-color: #fff; 851 | border: 1px solid #aaa; 852 | font-size: 16px; 853 | padding: 5px 10px; 854 | } 855 | 856 | .comment-list-panel { 857 | margin-top: 30px; 858 | } 859 | 860 | .comment-list { 861 | margin-top: 15px; 862 | } 863 | 864 | .comment-item:not(:last-child) { 865 | border-bottom: 1px #ccc solid; 866 | margin-bottom: 20px; 867 | padding-bottom: 20px; 868 | } 869 | 870 | .comment-item .nickname, 871 | .comment-item .submit-date { 872 | color: #777; 873 | font-size: 14px; 874 | } 875 | 876 | .comment-item .nickname:after { 877 | content: ' ·'; 878 | } 879 | 880 | .comment-item .text { 881 | padding-top: 5px; 882 | font-size: 16px; 883 | } 884 | 885 | /** 886 | * 13.0 - Pagination 887 | */ 888 | .pagination-simple { 889 | padding-left: 30px; 890 | font-size: 16px; 891 | } 892 | 893 | .pagination ul { 894 | list-style: none; 895 | } 896 | 897 | .pagination ul li { 898 | display: inline-block; 899 | font-size: 16px; 900 | margin-right: 5px; 901 | } 902 | 903 | .current a { 904 | color: red; 905 | } 906 | --------------------------------------------------------------------------------