摘要:1.首先注册应用,获取 appkey、appsecret api_url = "https://oapi.dingtalk.com/gettoken?appkey=%s&appsecret=%s"%(appkey,appsecret) def get_token(): # try: res = re
阅读全文
摘要:Django数据库迁移报错:1267, "Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='" 原因是在创建数据库时没有指定编码utf8 正确
阅读全文
摘要:1.安装node wget https://nodejs.org/dist/v10.15.0/node-v10.15.0-linux-x64.tar.xz 2.解压 tar -xf node-v10.15.0-linux-x64.tar.xz 3.配置全局变量 # vim /etc/profile
阅读全文
摘要:import pypinyin # 不带声调的(style=pypinyin.NORMAL) def pinyin(word): s = '' for i in pypinyin.pinyin(word, style=pypinyin.NORMAL): s += ''.join(i) return
阅读全文
摘要:import os file_path = "/var/www/project/logs/projectpom.log" (filepath,tempfilename) = os.path.split(file_path) (filename,extension) = os.path.splitex
阅读全文
摘要:brew search nginx //查询要安装的软件是否存在 brew install nginx 下载nginx open /usr/local/etc/nginx/ 打开nginx目录:servers目录以及nginx.conf open /usr/local/Cellar/nginx //
阅读全文
摘要:在执行python3 manage.py migrate时出现以下错误 ?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default' HINT: MySQL's Strict Mode fixes man
阅读全文
摘要:在执行git clone时候,因为网络慢导致克隆总是失败 vim /ect/hosts/ 添加以下两行命令 151.101.76.249 github.global.ssl.fastly.net 192.30.253.112 github.com 执行以下命令,使hosts文件生效 sudo dsc
阅读全文
摘要:scp -P 22 -r /home/server Android@192.168.1.110:/opt 将本地/home/server的文件夹上传到远端服务器192.168.1.110的目录/opt下 scp -P 22 -r android@192.168.1.110:/opt/docs /ho
阅读全文
摘要:首先检查自己的设备是否已经安装了jdk,在cmd终端输入,如已安装出现对应的版本信息,未安装弹出提示窗,官方网址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html java -ver
阅读全文
摘要:正常我们在cmd终端输入python之后,如果有安装python,就会在回车之后出来关于你安装的python版本信息,几版本,多少位的,但是还有一种,像我这样只显示了python版本是3.7.5,并没有体现是多少位的,在安装其他一些程序的时候,这些信息都是需要彼此对应的,那么就用到了下面解决方案 #
阅读全文
摘要:id_rsa.pub路径:cat ~/.ssh/id_rsa.pub 在配置了ssh免密认证id_rsa.pub之后,在cmd终端可以实现免密登陆对应配置了密钥的服务器,但是在python程序中,想要调用cmd执行免密操作,还需要安装sshpass,sshpass用于非交互式的ssh密码验证 没有s
阅读全文
摘要:linux下同步文件夹 rsync -avz /local_position/test_dir/ root@192.168.1.165:/target_position # ps:rsync -avz本地路径+要传送的文件夹 远程用户@远程ip:要上传到的目录 上述命令执行之后,cmd命令行一直处于
阅读全文
摘要:<button id="test" name="test_name" value="test_value"></button> 上面是一个在前端页面中展示的一个button,通过点击button获得相应的value $('#test').attr('name') 得到结果 test_name
阅读全文
摘要:1.首先在项目同名目录下建一个celery.py from __future__ import absolute_import import os from celery import Celery from datetime import timedelta from kombu import Q
阅读全文
摘要:import requests import json try: import cookielib except: import http.cookiejar as cookielib # 使用urllib2请求https出错,做的设置 import ssl context = ssl._creat
阅读全文
摘要:1.with open写文件到本地 2.paramiko SFTPClient将文件推到salt服务端 3.paramiko SSHClient通过salt-cp将文件分发给目标服务器 1. with open(filePath, 'w') as f: # filePath文件本地路径,w writ
阅读全文
摘要:我们常常在Linux下去查找文件 find / -name 'test.py' # 在根目录下查找名为test.py的文件 但是如果用查找文件的方式去查找文件夹的话,是查不到的 find / -maxdepth 1 -type d -name 'test_dictionary' # -maxdept
阅读全文
摘要:list是python中较为常见的数据类型,它是一个可迭代对象,迭代是什么?简单的可以理解成:一个可以被for循环遍历的对象 今天拿到一个类似这样的list list_info = ['name zhangsan','age 10','sex man','name lisi','age 11','s
阅读全文
摘要:python3 manage.py makemigrations # 生成数据库迁移文件 python3 manage.py migrate # 迁移数据库 简简单单两条命令就完成了django的数据库迁移 但是今天一天的时间都耽误在这了,一点都不夸张的那种,,早上去公司讨论需求之后,研究了一下需要
阅读全文
摘要:mysql -uroot -p 输入密码之后报错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)sudo /usr/local/MySQL/support-files/mysql.s
阅读全文