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

浙公网安备 33010602011771号