自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(23)
  • 收藏
  • 关注

转载 检查注释对照表

注释对应检查说明# noinspection PyUnusedLocalThis inspection highlights local variables,parameters or local functions unused in scope.# noinspection PyUnresolvedReferencesThis inspection detects...

2019-07-25 11:12:46 6247 1

原创 python 自定义微信公众号 (wechat-sdk)

背景:python3.6,django安装wechat-sdk,windows下安装不成功的可以参考这个python在windows下安装wechat-sdk在公众号的基本配置中,要开启开发者密码,且要做好记录,如果用的地方超过两个,重置将会很麻烦添加ip白名单,接下来填写服务器配置,此信息需要发送到服务器资源,url接口只支持80或443端口,且填写的url要能响应微信发送的token验证...

2019-06-06 17:39:48 582

原创 python在windows下安装wechat-sdk(附stdint.h文件代码)

python:3.6环境:windows需求:自定义开发公众号安装wechat-sdk时报错:failed builiding wheel for pycrypto单独安装 pycrypto,报错如下:error C2061: 语法错误: 标识符“intmax_t”;error C2059: 语法错误:“;” ;error C2143: 语法错误: 缺少“{”(在“__cdecl”...

2019-06-06 16:26:25 977

原创 nginx之又一次配置https

阿里云购买证书(按需购买)这次买的是类型为专业版OV ssl、品牌GeoTrust,、多个域名邮件提醒:选择验证方式:1、DNS验证,在域名解析控制台中添加一条txt解析记录 2、文件验证,需要保存txt文本文件,在web服务器站点下创建隐藏目录,最后访问链接可以看到内容即可emmm,我当然是选择了添加DNS验证,收到记录值后:控制台中找到云解析DNS,对购买的域名进行解析配...

2019-05-23 10:21:53 193

原创 ubantu下安装ffmpeg(包含音频转码)

下载压缩包,解压,编译wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2tar xjvf ffmpeg-snapshot.tar.bz2cd ffmpeg./configure --prefix=/usr/local/ffmpeg --enable-shared --disable-static --disable-docmak...

2019-03-26 10:08:41 340 1

原创 uwsgi的使用

当我开始想要利用django+uwsgi+nginx部署项目时,想起python3是与python2共存的,当初安装的应该是python2的uwsgi,所以,重新安装python3下的uwsgi然后,测试uwsgi --http :8001 --wsgi-file test.py可以使用,然后为我的django项目创建一个uwsgi的配置文件,方便起见,放在项目根目录下喽,配置完成后,启动...

2019-01-24 15:30:29 357

原创 ubantu安装libxml*的报错

首先,标准步骤走一下 sudo apt-get install libxml*美滋滋中,发现报错,类似于:Depends: XXX(=YYY) but ZZZ is to be installedDepends: libglib2.0-0 (= 2.40.2-0ubuntu1) but 2.42.0-2 is to be installed不应该啊!!!,改错可以尝试:apt-ge...

2019-01-24 11:01:33 325

原创 上传文档(提取文本信息)

from zipfile import ZipFilefrom bs4 import BeautifulSoupdocument = ZipFile(root_file)# document = ZipFile('D:/Users/Administrator/Desktop/a.docx')xml = document.read("word/document.xml")root = Be...

2018-12-18 09:39:26 433

原创 网页加载慢

浏览器访问网站时发现建立连接( Initial connection)时巨慢在百度统计网站测试时,网络连接项扣除40分该网址可解决此问题https://blog.csdn.net/chenjian88886666/article/details/79726408原因:同一个域名绑定了2个IP查看位置:阿里云域名解析...

2018-12-18 09:12:04 597

原创 获取模型中完整的多对多数据

可获取到model中query多对多的完整数据 query = queryset.order_by(ordering).first() for topic in query._meta.many_to_many: lista = list(topic.value_from_object(query).values_list('pk', fla...

2018-12-17 14:29:42 212

原创 oss 对象存储(上传,删除)

import oss2import os,sysfrom xucas.settings import MEDIA_ROOTaccess_key_id = os.getenv('OSS_TEST_ACCESS_KEY_ID', '你的ACCESS_KEY_ID')access_key_secret = os.getenv('OSS_TEST_ACCESS_KEY_SECRET', '你的K...

2018-10-24 16:54:55 1316

原创 获取视频时长,截帧

# 安装 opencv-pythonimport cv2import numpy as nppath = r'D:\Users\Administrator\Desktop\1.mp4'vc = cv2.VideoCapture(path)if (vc.isOpened()): rval, frame = vc.read() print('Open')else: prin...

2018-10-24 16:54:13 1037

原创 实现导入文档

可导入文档类型为doc或docx思路:导入文档,解析# 找到文件,解析文件from win32com import client as wcroot_file = MEDIA_ROOT + "/" + file.namepythoncom.CoInitialize()word = wc.Dispatch('Word.Application')if u'.doc' in file.n...

2018-10-24 13:11:16 297

原创 图片加水印

支持(‘jpe’, ‘jpg’, ‘jpeg’, ‘gif’, ‘png’, ‘bmp’, ‘ico’, ‘tif’, ‘tiff’)from PIL import Image, ImageDraw,ImageFonttext = "玉飞12345"font = ImageFont.truetype("msyh.ttf", 20)layer = Image.open("testimg/1...

2018-10-17 18:12:06 149

原创 微信支付 django

微信支付有条件,必须申请公众号为服务号settings配置# 商户idWEIXIN_SHANG_ID = "xxxx"微信支付,获取二维码from PIL import Image,ImageOpsfrom users.models import UserProfilefrom datetime import datetime, timedeltaimport qrc...

2018-09-04 15:36:50 776

原创 支付宝支付 Django

必备条件,公钥密钥 setting配置# # 支付宝沙箱# ALIPAY_APPID = "xxxxxxx"# ALIPAY_URL = "https://openapi.alipaydev.com/gateway.do"# 支付宝配置参数ALIPAY_APPID = "xxxxx"ALIPAY_URL = "h

2018-09-04 14:53:54 388

原创 关于下载路径包含中文所走的路

是否安装的有语言包??http://wiki.ubuntu.org.cn/Locale使用命令locale “”” LANG=zh_CN.UTF-8 LANGUAGE= LC_CTYPE=”zh_CN.UTF-8” LC_NUMERIC=”zh_CN.UTF-8” LC_TIME=”zh_CN.UTF-8” LC_COL...

2018-09-04 10:01:46 706

原创 前后端分离跨域问题

settings配置:CORS_ALLOW_CREDENTIALS = True CORS_ORIGIN_ALLOW_ALL = True CORS_ALLOW_HEADERS = (‘*’)MIDDLEWARE = [ ‘django.middleware.security.SecurityMiddleware’, ‘django.contrib.sessions...

2018-08-30 09:17:10 199

原创 django+uwsgi+nginx部署

部署django+nginx+uwsgi为了实现nginx防盗链而开始测试uwsgidef application(env, start_response): start_response('200 OK', [('Content-Type','text/html')]) return “HelloWorld”命令:uwsgi –http :8001 –wsg...

2018-08-21 10:21:15 178

原创 视频流响应

import re import os from wsgiref.util import FileWrapper from django.http import StreamingHttpResponse import mimetypes def video(request): # path = “/home/xxx/media/10001_1.mp4” path =...

2018-08-21 10:20:55 530

原创 视频流响应(safari)

初期处理借鉴https://www.jb51.net/article/144137.htmimport reimport osfrom wsgiref.util import FileWrapperfrom django.http import StreamingHttpResponsedef file_iterator(file_name, chunk_size=8192, o...

2018-08-21 10:20:42 986

原创 多对多数据添加/更改

添加: videotitle.type.add(type1) videotitle.type.add(type2) videotitle.save()更改: videotitle.title, videotitle.describe, videotitle.video_img = title, desc, img videotitle.type = type1...

2018-08-21 10:20:29 1954

原创 queryset集合筛选等操作

queryset = UserQuizFree.objects.filter(user=user) a = [] for quiza in queryset: if search in quiza.title.title: a.append(quiza) queryset = UserQuizF...

2018-08-21 10:20:14 3365 1

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除