欢迎来到Felix的博客

Do the right things! And talk is cheap,show me your code!

随笔分类 -  Django

摘要:1、下载项目 git clone https://github.com/wangyitao/MyBlogs.git 2、进入Myblogs目录 cd MyBlogs 3、创建虚拟环境并且安装依赖 pipenv install 4、搭建mysql环境,以及创建数据库和用户 5、修改代码,符合自己的需求 阅读全文
posted @ 2019-01-05 12:03 寂静的天空 阅读(1095) 评论(0) 推荐(0)
摘要:1、变化的部分: 2、上代码 from django.db import models from django.urls import reverse from django.contrib.auth.models import User from django.contrib.contenttyp 阅读全文
posted @ 2018-11-30 16:16 寂静的天空 阅读(268) 评论(0) 推荐(0)
摘要:1、修改的部分 2、上代码 {% load staticfiles %} <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <!-- 根据屏幕自动响应布局 --> <meta name="viewport" content= 阅读全文
posted @ 2018-11-30 10:43 寂静的天空 阅读(299) 评论(0) 推荐(0)
摘要:1、邮箱服务器使用了腾讯服务器 具体操作见:python自动发邮件 2、变化的部分 3、上代码: {# 引用模板 #} {% extends 'base.html' %} {% load staticfiles %} {% load comment_tags %} {% load likes_tag 阅读全文
posted @ 2018-11-29 11:53 寂静的天空 阅读(492) 评论(0) 推荐(0)
摘要:2、变化的部分 {% load staticfiles %} <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <!-- 根据屏幕自动响应布局 --> <meta name="viewport" content="width 阅读全文
posted @ 2018-11-25 20:44 寂静的天空 阅读(212) 评论(0) 推荐(0)
摘要:1、变化的部分 2、上代码: {# 引用模板 #} {% extends 'base.html' %} {% load staticfiles %} {% load comment_tags %} {% load likes_tags %} {% block header_extends %} <l 阅读全文
posted @ 2018-11-25 16:11 寂静的天空 阅读(368) 评论(0) 推荐(0)
摘要:1、变化的部分: 2、上代码: {# 引用模板 #} {% extends 'base.html' %} {% load staticfiles %} {% load comment_tags %} {% load likes_tags %} {% block header_extends %} < 阅读全文
posted @ 2018-11-25 11:33 寂静的天空 阅读(265) 评论(0) 推荐(0)
摘要:新创建一个app来单独实现点赞的功能。 1、变化的部分 2、上代码 ul.blog-types,ul.blog-dates { list-style-type: none; } div.blog:not(:last-child) { margin-bottom: 2em; padding-botto 阅读全文
posted @ 2018-11-23 20:39 寂静的天空 阅读(809) 评论(0) 推荐(0)
摘要:使用自定义模板标签实现了评论计数,获取评论列表等功能 1、变化的部分 2、上代码 ul.blog-types,ul.blog-dates { list-style-type: none; } div.blog:not(:last-child) { margin-bottom: 2em; paddin 阅读全文
posted @ 2018-11-22 21:56 寂静的天空 阅读(204) 评论(0) 推荐(0)
摘要:接上一篇添加评论功能之后,增加回复的功能。 1、变化的部分 2、上代码 ul.blog-types,ul.blog-dates { list-style-type: none; } div.blog:not(:last-child) { margin-bottom: 2em; padding-bot 阅读全文
posted @ 2018-11-22 19:36 寂静的天空 阅读(213) 评论(0) 推荐(0)
摘要:编辑功能使用到了ckeditor的MathJax组件。ajax提交评论可以不用刷新浏览器。 1、变化的部分 2、上代码: ul.blog-types,ul.blog-dates { list-style-type: none; } div.blog:not(:last-child) { margin 阅读全文
posted @ 2018-11-21 22:54 寂静的天空 阅读(298) 评论(0) 推荐(0)
摘要:1、变化的部分 2、上代码: {# 引用模板 #} {% extends 'base.html' %} {% load staticfiles %} {% block header_extends %} <link rel="stylesheet" href="{% static 'blog/blo 阅读全文
posted @ 2018-11-20 22:25 寂静的天空 阅读(233) 评论(0) 推荐(0)
摘要:1、变化的部分 2、上代码 ul.blog-types,ul.blog-dates { list-style-type: none; } div.blog:not(:last-child) { margin-bottom: 2em; padding-bottom: 1em; border-botto 阅读全文
posted @ 2018-11-20 19:13 寂静的天空 阅读(200) 评论(0) 推荐(0)
摘要:因为评论可以作为一个模块,所以单独创建一个app,专门用来处理评论。 1、变化的部分 2、上代码 {# 引用模板 #} {% extends 'base.html' %} {% load staticfiles %} {% block header_extends %} <link rel="sty 阅读全文
posted @ 2018-11-19 19:21 寂静的天空 阅读(538) 评论(0) 推荐(1)
摘要:1、变化的部分 2、上代码: from django.db import models from django.contrib.auth.models import User from django.contrib.contenttypes.fields import GenericRelation 阅读全文
posted @ 2018-11-19 11:26 寂静的天空 阅读(191) 评论(0) 推荐(0)
摘要:之前写了单篇博客的阅读量统计,今天添加了博客总阅读量统计,并且使用highcharts图表显示。 1、变化的部分 2、上代码: # -*- coding: utf-8 -*- # @Time : 18-11-7 下午4:12 # @Author : Felix Wang from django.sh 阅读全文
posted @ 2018-11-18 22:15 寂静的天空 阅读(238) 评论(0) 推荐(0)
摘要:1、将阅读量的代码封装在一个app中,增加扩展性 新建app: 2、变化的部分 3、上代码 from django.contrib import admin from .models import BlogType, Blog # Register your models here. @admin. 阅读全文
posted @ 2018-11-17 22:51 寂静的天空 阅读(495) 评论(0) 推荐(0)
摘要:1、变化的部分 2、上代码 {# 引用模板 #} {% extends 'base.html' %} {% load staticfiles %} {% block header_extends %} <link rel="stylesheet" href="{% static 'blog/blog 阅读全文
posted @ 2018-11-17 18:05 寂静的天空 阅读(190) 评论(0) 推荐(0)
摘要:1、变化的部分 2、上代码 ul.blog-types,ul.blog-dates { list-style-type: none; } div.blog:not(:last-child) { margin-bottom: 2em; padding-bottom: 1em; border-botto 阅读全文
posted @ 2018-11-17 14:00 寂静的天空 阅读(239) 评论(0) 推荐(0)
摘要:使用django默认的编辑器感觉功能太少了,所以集成一下富文本编辑器。 1、安装和使用 (1)、安装 (2)、注册应用 在django的settings中添加‘ckeditor’的app (3)、配置models 将需要用到富文本编辑器的字段改成RichTextField 上面三步配置过后是不能上传 阅读全文
posted @ 2018-11-17 11:26 寂静的天空 阅读(287) 评论(0) 推荐(1)

个人感悟: 一个人最好的镜子就是自己,你眼中的你和别人眼中的你,不是一回事。有人夸你,别信;有人骂你,别听。一根稻草,扔街上就是垃圾;捆上白菜就是白菜价;捆上大闸蟹就是大闸蟹的价。 一个人,不狂是没有出息的,但一直狂,肯定是没有出息的。雨打残花风卷流云,剑影刀光闪过后,你满脸冷酷的站在珠峰顶端,傲视苍生无比英武,此时我问你:你怎么下去? 改变自己就是改变自己的心态,该沉的时候沉下去,该浮的时候浮上来;不争名夺利,不投机取巧,不尔虞我诈;少说、多听、多行动。人每所谓穷通寿夭为命所系,岂不知造物之报施,全视人之自取。 座佑铭:每一个不曾起舞的日子,都是对生命的辜负。