2018年12月21日
摘要: 一、rest=framework之解析器 1)解析器作用。 根据提交的数据。只解析某些特定的数据。非法数据不接收,为了系统安全问题 比如解析的数据格式有 有application/json,x-www-form-urlencoded,form-data等格式 默认支持的数据类型 'rest_fram 阅读全文
posted @ 2018-12-21 18:17 可口_可乐 阅读(175) 评论(0) 推荐(0) 编辑
  2018年12月16日
摘要: 一、Django中的缓存的几种方法 1)单个视图缓存。时间测试 import time from django.views.decorators.cache import cache_page @cache_page(5) # 缓存5秒 def test_time(request): ctime=t 阅读全文
posted @ 2018-12-16 22:35 可口_可乐 阅读(426) 评论(0) 推荐(0) 编辑
摘要: 一、redis在Python下的基本使用 1)安装 pip install redis 2) 简单的使用测试 import redis r = redis.Redis(host='127.0.0.1', port=6379) r.set('foo', 'Bar') print(r.get('foo' 阅读全文
posted @ 2018-12-16 22:19 可口_可乐 阅读(307) 评论(0) 推荐(0) 编辑
  2018年12月15日
摘要: 一、同源策略 同源策略(Same origin policy)是一种约定,它是浏览器最核心也最基本的安全功能,如果缺少了同源策略,则浏览器的正常功能可能都会受到影响。可以说Web是构建在同源策略基础之上的,浏览器只是针对同源策略的一种实现 请求的url地址,必须与浏览器上的url地址处于同域上,也就 阅读全文
posted @ 2018-12-15 16:24 可口_可乐 阅读(169) 评论(0) 推荐(0) 编辑
  2018年12月7日
摘要: 一、Python发送邮件 import smtplib from email.mime.text import MIMEText def send(email_to,title,content): msg = MIMEText(content,"plain","utf-8") froms = "12 阅读全文
posted @ 2018-12-07 22:48 可口_可乐 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 一、登录ssh失败次数统计 1)错误的打开方式 awk '/Failed password/ {print $(NF-3)}' secure |sort -n |uniq -c|sort -n |tail /var/log/secure 2)拷贝文件,再查看失败 cp /var/log/secure 阅读全文
posted @ 2018-12-07 17:20 可口_可乐 阅读(844) 评论(0) 推荐(0) 编辑
  2018年12月3日
摘要: [root@k8s6 proc]# ps aux|grep -v PID|sort -rn -k +3|head -5 root 921 0.4 0.9 582140 38532 ? Ssl 17:19 0:29 /usr/bin/dockerd root 691 0.2 0.1 305296 63 阅读全文
posted @ 2018-12-03 21:00 可口_可乐 阅读(1031) 评论(0) 推荐(0) 编辑
  2018年11月22日
摘要: 一、搭建nginx 1)基础依赖包安装 2)nginx环境准备 问题处理 yum -y install openssl openssl-devel 3)编译参数。指定目录 /opt/lnmp_zabbix/nginx 3)编译成功则执行 二、编译安装mysql(方法一) 1) 下载mysql,创建m 阅读全文
posted @ 2018-11-22 12:25 可口_可乐 阅读(461) 评论(0) 推荐(0) 编辑
  2018年11月16日
摘要: 一、基本环境搭建 1)查看服务器 2)安装基本的依赖包 二、搭建mysql,nginx,python环境 1.1)安装mysql5.6版本 1.2)设置mysql 1.3)测试连接 2.1)安装nginx 2.2)常用的编译参数 编译参数说明 2.3)nginx文件夹说明 2.4)nginx启动命令 阅读全文
posted @ 2018-11-16 16:50 可口_可乐 阅读(419) 评论(0) 推荐(0) 编辑
  2018年11月6日
摘要: 一、playbook剧本介绍 1)playbook介绍 Playbooks是Ansible的配置,部署和编排语言。它们可以描述您希望远程系统执行的策略,或一般IT流程中的一组步骤。 如果说ansible 模块 是你车间里的工具,那么playbooks 是你的说明书/使用手册,并且资源清单上的主机是你 阅读全文
posted @ 2018-11-06 15:37 可口_可乐 阅读(311) 评论(0) 推荐(0) 编辑