摘要: 1. Md5加密 2. sha256加密 3. 时间戳封装 4. 删除外键关系 阅读全文
posted @ 2020-02-29 15:12 Mr-刘 阅读(230) 评论(0) 推荐(0) 编辑
摘要: ``` # 导入已封装好的函数-- 也成工具文件夹 from utils.sha2203 import * import hashlib import random import re # 封装sha256 def sha56(raw): # 实例化sha256对象 sha56 = hashlib.sha256() # 把要加密的密码,进行update操作并转成utf-8,不写默认是utf-8 s 阅读全文
posted @ 2020-02-29 15:10 Mr-刘 阅读(418) 评论(0) 推荐(0) 编辑
摘要: ```# 1. 反序列化----单表入库class Addcate(APIView): def post(self,request): # 用postman进行存入数据 data = request.data # 把定义好的反序列化拿来进行存入数据,也就是把获取的数据转成python串 cate = CateUnserializer(d... 阅读全文
posted @ 2020-02-29 14:57 Mr-刘 阅读(822) 评论(0) 推荐(0) 编辑
摘要: ``` import pymysql pymysql.install_as_MySQLdb() # 关系型数据库:mysql,sqlite,oracle,sqlserver,postgresql # 非关系型数据库:redis,memcache,mongodb ``` 阅读全文
posted @ 2020-02-29 14:55 Mr-刘 阅读(114) 评论(0) 推荐(0) 编辑
摘要: ``` # 用户统计模块 from datetime import datetime,timedelta def user_Count(request): # 1.一共有多少用户 tcount = Admins.objects.count() # 2.当月注册用户总数,条件(create_time开始时间,这个月1号到现在) start_time = datetime.strftime(datet 阅读全文
posted @ 2020-02-29 14:52 Mr-刘 阅读(109) 评论(0) 推荐(0) 编辑
摘要: ``` #店主表 class Shop(models.Model): name = models.CharField(max_length=50) passwd = models.CharField(max_length=255) class Meta: db_table = 'shop' #商品表 class Goods(models.Model): name = models.CharFiel 阅读全文
posted @ 2020-02-29 14:49 Mr-刘 阅读(625) 评论(0) 推荐(0) 编辑
摘要: ```商品名称:商品价格:商品图片:添加 methods:{ addgoods:function () { var user_id = sessionStorage.getItem('id'); this.user_id = user_id; var data = new FormDat... 阅读全文
posted @ 2020-02-29 14:46 Mr-刘 阅读(1069) 评论(0) 推荐(0) 编辑
摘要: ``` Django 模板继承 (1)、在一个完整的HTML里面写入 Document {% block head %} >继承的格式(有开始,有结束) (继承头部) 电器 日用品 可以是动态的 水果 {% endblock head %} >(结束头部继承) {% block body %} >继承的格式(有开始,有结束) (继承内容) {% endblock body %} >(结束内容继承) 阅读全文
posted @ 2020-02-29 14:36 Mr-刘 阅读(153) 评论(0) 推荐(0) 编辑
摘要: ``` 例--示范 # 电影表 class Move(models.Model): name = models.CharField(max_length=50) image_url = models.CharField(max_length=255) class Meta: db_table = 'move' def __str__(self): return self.name # 演员表 cl 阅读全文
posted @ 2020-02-29 13:36 Mr-刘 阅读(284) 评论(0) 推荐(0) 编辑
摘要: ```一、需要把captcha的文件夹,复制到本Django项目目录下,utils文件夹里from utils.captcha.captcha import captcha# 验证码----------图片class ImageView(View):def get(self,request):# text------->图片中的文本# image---------->图片name,text,ima... 阅读全文
posted @ 2020-02-29 13:35 Mr-刘 阅读(109) 评论(0) 推荐(0) 编辑
摘要: ```安装命令1. pip install djangorestframework2. from rest_framework.views import APIView 2.引入--rest_framework---->下划线,需要在配置文件夹app处的地方加入序列化的类---将python数据类型转换成josn字符串3.单写一个py文件 myserializers.py导包: from ... 阅读全文
posted @ 2020-02-29 13:33 Mr-刘 阅读(245) 评论(0) 推荐(0) 编辑
摘要: ``` 生成项目文件 Django-admin startproject 项目名称 子应用 cd 到项目名称下 python manage.py startapp 子应用名称 启动服务 python manage.py runserver 配置文件样式 例: import os # Build paths inside the project like this: os.path.join(BAS 阅读全文
posted @ 2020-02-29 13:32 Mr-刘 阅读(140) 评论(0) 推荐(0) 编辑
摘要: ``` 删除 修改与删除等的操作,都从前台传来一个id获取后执行 class Delete_two_cate(View): def get(self,request): id = request.GET.get('id') try: two = Twocate.objects.filter(id=id).delete() except: two = {} return redirect('/tne 阅读全文
posted @ 2020-02-29 13:31 Mr-刘 阅读(720) 评论(0) 推荐(0) 编辑
摘要: ``` 1.图文混排(富文本编辑器) 在HTML里面导入三个包 (1) jquery.1.12.4 (2) tinymce.min.js (3) tinymce_setup.js 注意:setup里面:selector : "#rich_content" 跟hTml 里面的 input 框 id 相对应 # 例: 且注意浏览器有缓存,检查源码查看action提交的位置, 如果报错 请查看路由路径的 阅读全文
posted @ 2020-02-29 13:30 Mr-刘 阅读(188) 评论(0) 推荐(0) 编辑
摘要: ``` 多对多(二级分类,商品表,) 字段--名字 价格 库存 简介 详情 图片 销售量 评论数量 二级分类的外键 评价 下拉菜单选值俩个--多个 multiple 商品表:Class goods(models.Models): 名字: name = models.Charfield(max_length=50) 价格: price = models.DecimalField(max_digits 阅读全文
posted @ 2020-02-29 13:29 Mr-刘 阅读(132) 评论(0) 推荐(0) 编辑
摘要: ``` #邮箱发送 需要正则验证 import re class Index(View): def get(self,request): return HttpResponse('ok') def post(self,request): mes = {} # 1.获取数据 email = request.POST.get('email') # 2.验证 if not email: mes['cod 阅读全文
posted @ 2020-02-29 13:28 Mr-刘 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 简介 + 路由跳转 + 路由分发 例: + 子路由 阅读全文
posted @ 2020-02-29 13:27 Mr-刘 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 一, vue端 二,Django端 三,axios用法 阅读全文
posted @ 2020-02-29 13:22 Mr-刘 阅读(549) 评论(0) 推荐(0) 编辑
摘要: [TOC] 1. 并发,并行的理解 2. 用代码实现多线程爬虫 阅读全文
posted @ 2020-02-29 12:27 Mr-刘 阅读(406) 评论(0) 推荐(0) 编辑
摘要: [TOC] 1. scrapy安装与环境依赖 2. 创建项目等 命令介绍 3. 项目目录介绍 4. 框架scrapy介绍:五大核心组件与数据流向 5. scrapy 爬取科客网站 6. scrapy实现多页爬取 9. scrapy 篡改请求与响应,item丢弃 10. scrapy中间件 分类,作用 阅读全文
posted @ 2020-02-29 12:26 Mr-刘 阅读(420) 评论(0) 推荐(0) 编辑