摘要:首先说一下需求,我们有2套前后端的项目要做集成,其中一套使用开源系统scui作为portal,另外一套A项目以iframe的形式加到portal菜单里去。并且想要实现从portal跳转A项目时候是免密的,无需再次登陆。 这时候了解到vue的localstorage存的信息在同一个域名,同一个端口的情
阅读全文
摘要:import logging import os from logging import handlers class Logger(object): # 日志级别关系映射 level_relations = { 'debug': logging.DEBUG, 'info': logging.INF
阅读全文
摘要:启动flask项目python3 app.py的时候遇到报错: zsh: abort Abort trap: 6 在网上查到好几种解决办法,尝试修改zsh为shell的过程中不断在遇到新的问题。 于是我尝试了其他项目启动的时候是没有报错的,只有这个项目遇到这样的问题,项目依赖的包都通过require
阅读全文
摘要:方法1:pillow将多张图片显示在一张画布上 缺点:每张画布上图片个数必须是给定数量 class MakeCodeAction(BaseActionView): # 这里需要填写三个属性 action_name = "create_assets_qr_code" description = u'C
阅读全文
摘要:def sh(self,cmds, print_msg=True): print('sh') msgStr = [] env = ###dev### compilePopen = subprocess.Popen(cmds,shell=True,stdout=subprocess.PIPE,clos
阅读全文
摘要:宿主机: 1、在Linux服务器上的处理 首先需要在Linux中安装python,并且安装pywinm库。安装之前首先需要安装isodate和xmlwitch两个依赖包,在安装pywinrm。下面是安装时用到的命令。 安装依赖包 pip install isodatepip install xmlw
阅读全文
摘要:安装: # pip3 install apscheduler==2.1.2 使用:在Django项目settings.py同级urls.py from apscheduler.scheduler import Scheduler sched = Scheduler() @sched.interval
阅读全文
摘要:启动服务 redis-server 启动客户端 redis-cli # 哈希常用操作 存hash类型键值对 hset aa 11 111 取hash类型键值对 hget aa 11 获取hash下所有键值对 hgetall aa 删除hash键值对 hdel aa 11 # 列表常用操作 从右边推入
阅读全文
摘要:pip3 install aliyun-python-sdk-core pip3 install aliyun-python-sdk-ecs
阅读全文
摘要:什么是ZBar?ZBar是一个开源库,用于扫描、读取二维码和条形码。支持的二维码包括:EAN/UPC,QR等。 ubuntu16.04安装方式 sudo apt-get install libzbar-dev pip install zbar # 亲测有效 centos7 安装方式 yum inst
阅读全文
摘要:xadmin:是django的一套优于admin的后台管理系统,不仅提供了可观性更高的UI界面,还封装了基于模型类的CURD,支持过滤查询,多种形式的数据导出,还有很多方便易用的小插件。它的缺点是,如果有一些自定义的功能,页面展示部分和权限控制部分可能需要改底层代码,不是特别方便我的场景是,一对多的
阅读全文
摘要:import random,string #调用random、string模块 def create_password(): src_digits = string.digits #string_数字 src_uppercase = string.ascii_uppercase #string_大写
阅读全文
摘要:报错 import libvirt ImportError: No module named libvirt 解决 # brew install libvirt # brew install libvirt-python # pip install libvirt-python
阅读全文
摘要:装饰器验证接口响应时长 from time import time def print_execute_time(func): def wrapper(*args, **kwargs): start = time() func_return = func(*args, **kwargs) end =
阅读全文
摘要:1、下载 pip3 install webssh 2、启动webssh服务 # 直接运行wssh,使用默认8888端口 wssh # 通过绑定IP地址和端口启动 wssh --address='192.168.0.123' --port=8888 wssh --address='0.0.0.0' -
阅读全文
摘要:我们可以使用echo_supervisord_conf命令得到supervisor配置模板,打开终端执行如下Linux shell命令: # echo_supervisord_conf > supervisord.conf 该命令输出文件到当前目录下(当然,你也可以指定绝对路径到具体位置),文件名为
阅读全文
摘要:settings.py INSTALLED_APPS = ( 'djcelery', ) import djcelery djcelery.setup_loader() BROKER_URL = 'redis://localhost:6379' CELERYBEAT_SCHEDULER = 'djc
阅读全文
摘要:1、 wget https://pypi.python.org/packages/5b/0b/34be574b1ec997247796e5d516f3a6b6509c4e064f2885a96ed885ce7579/requests-2.12.4.tar.gz 2、 tar -zxvf reques
阅读全文
摘要:此时python版本2.7,requests版本2.12.4在命令行输入python后导入模块,import requests之后有警告: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python 这时
阅读全文
摘要:# -*- coding:utf-8 -*- from django.shortcuts import render from django.http import JsonResponse,HttpResponse from django.views.generic import Viewimpo
阅读全文