小陆同学

python 中文名:蟒蛇,设计者:Guido van Rossum

导航

2020年8月28日 #

vue--webpack版本过高问题

摘要: 问题: 项目可以启动没有问题,访问页面白页加载不到东西 BaseClient.js:23 Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>' 解决办法:https://www. 阅读全文

posted @ 2020-08-28 21:43 小陆同学 阅读(847) 评论(1) 推荐(0) 编辑

python--随机生成8为大小写字母数字组成的密码

摘要: import random,string #调用random、string模块 def create_password(): src_digits = string.digits #string_数字 src_uppercase = string.ascii_uppercase #string_大写 阅读全文

posted @ 2020-08-28 21:35 小陆同学 阅读(1990) 评论(0) 推荐(0) 编辑

mac--在MAC上安装Libvirt-python

摘要: 报错 import libvirt ImportError: No module named libvirt 解决 # brew install libvirt # brew install libvirt-python # pip install libvirt-python 阅读全文

posted @ 2020-08-28 21:34 小陆同学 阅读(485) 评论(0) 推荐(0) 编辑

python--装饰器的常见使用

摘要: 装饰器验证接口响应时长 from time import time def print_execute_time(func): def wrapper(*args, **kwargs): start = time() func_return = func(*args, **kwargs) end = 阅读全文

posted @ 2020-08-28 21:32 小陆同学 阅读(223) 评论(0) 推荐(0) 编辑

python3--安装webssh服务

摘要: 1、下载 pip3 install webssh 2、启动webssh服务 # 直接运行wssh,使用默认8888端口 wssh # 通过绑定IP地址和端口启动 wssh --address='192.168.0.123' --port=8888 wssh --address='0.0.0.0' - 阅读全文

posted @ 2020-08-28 21:30 小陆同学 阅读(1186) 评论(1) 推荐(0) 编辑

django--celery 项目部署,进程管理,supervisor的使用

摘要: 我们可以使用echo_supervisord_conf命令得到supervisor配置模板,打开终端执行如下Linux shell命令: # echo_supervisord_conf > supervisord.conf 该命令输出文件到当前目录下(当然,你也可以指定绝对路径到具体位置),文件名为 阅读全文

posted @ 2020-08-28 21:25 小陆同学 阅读(493) 评论(1) 推荐(0) 编辑

python2--djnago xadmin 定时任务,手把手

摘要: settings.py INSTALLED_APPS = ( 'djcelery', ) import djcelery djcelery.setup_loader() BROKER_URL = 'redis://localhost:6379' CELERYBEAT_SCHEDULER = 'djc 阅读全文

posted @ 2020-08-28 21:20 小陆同学 阅读(271) 评论(0) 推荐(0) 编辑

python2--源码安装requests模块

摘要: 1、 wget https://pypi.python.org/packages/5b/0b/34be574b1ec997247796e5d516f3a6b6509c4e064f2885a96ed885ce7579/requests-2.12.4.tar.gz 2、 tar -zxvf reques 阅读全文

posted @ 2020-08-28 21:11 小陆同学 阅读(1122) 评论(0) 推荐(0) 编辑

python2--requests模块警告

摘要: 此时python版本2.7,requests版本2.12.4在命令行输入python后导入模块,import requests之后有警告: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python 这时 阅读全文

posted @ 2020-08-28 21:04 小陆同学 阅读(510) 评论(0) 推荐(0) 编辑

python2--编码问题汇总

摘要: # unicode编码字符串转码utf8 aaa = "\xxx\xxx\xxx\xxx" print(aaa.encode('utf-8').decode('unicode_escape')) # 字典类型的unicode编码类型,转utf8 # 1、可以用json.loads() # 2、 fr 阅读全文

posted @ 2020-08-28 20:59 小陆同学 阅读(119) 评论(0) 推荐(0) 编辑

linux--日志文件过大?查看日志文件某个时间段的内容

摘要: 某个时间段的日志输出到新文件 sed -n '/2020-06-17 17:00:00/,/2020-06-17 18:50:59/p' nohup.out >> 061717.log 查看文件大小 ll -lh 061717.log 将最近200行文件输出到新文件 sudo tail -200 n 阅读全文

posted @ 2020-08-28 20:54 小陆同学 阅读(1128) 评论(0) 推荐(0) 编辑

Docker-Ubuntu-bash:ping:找不到命令

摘要: 容器内运行ping命令:bash: ping: 未找到命令 apt-get update apt-get install iputils-ping mac下是由于系统限制是无法ping通容器的 https://docs.docker.com/docker-for-mac/networking/ 阅读全文

posted @ 2020-08-28 20:50 小陆同学 阅读(929) 评论(0) 推荐(0) 编辑

linux--如何拷贝目录

摘要: linux复制指定目录下的全部文件到另一个目录中复制指定目录下的全部文件到另一个目录中文件及目录的复制是经常要用到的。linux下进行复制的命令为cp。假设复制源目录 为 dir1 ,目标目录为dir2。怎样才能将dir1下所有文件复制到dir2下了如果dir2目录不存在,则可以直接使用cp -r 阅读全文

posted @ 2020-08-28 20:49 小陆同学 阅读(6293) 评论(0) 推荐(0) 编辑

python2--django返回二维码展示页面

摘要: # -*- coding:utf-8 -*- from django.shortcuts import render from django.http import JsonResponse,HttpResponse from django.views.generic import Viewimpo 阅读全文

posted @ 2020-08-28 20:47 小陆同学 阅读(329) 评论(0) 推荐(0) 编辑

django--时区问题导致mysql时间晚8小时怎么改

摘要: 1、设置Django项目的时区设置 USE_TZ = False 2、可能数据库已经有时间字段晚8小时的数据,需要将其用sql语句进行统一 # 查询目前数据库有哪些表有时间字段 select TABLE_SCHEMA,TABLE_NAME,COLUMN_NAME,DATA_TYPE from inf 阅读全文

posted @ 2020-08-28 20:42 小陆同学 阅读(401) 评论(0) 推荐(0) 编辑

mysql--备份,导入备份

摘要: 方法1、 导出(p后不空格直接密码),记住备份文件路径 mysqldump -u root -p密码 数据库 > 备份文件.sql 导入: 1、进入数据库:mysql -uroot -p 2、use 数据库 3、source 备份文件.sql 方法二:多张表同时 导出 mysqldump -u ro 阅读全文

posted @ 2020-08-28 20:36 小陆同学 阅读(228) 评论(0) 推荐(0) 编辑

linux--远程连接windows并执行cmd命令

摘要: 1、在Linux服务器上的处理 首先需要在Linux中安装python,并且安装pywinm库。安装之前首先需要安装isodate和xmlwitch两个依赖包,在安装pywinrm。下面是安装时用到的命令。 pip install isodate pip install xmlwitch pip i 阅读全文

posted @ 2020-08-28 20:29 小陆同学 阅读(3399) 评论(0) 推荐(0) 编辑

ERROR: error pulling image configuration

摘要: docker pull镜像时报错: ERROR: error pulling image configuration: Get https://production.cloudflare.docker.com/registry-v2/docker/registry/v2/blobs/sha256/7 阅读全文

posted @ 2020-08-28 20:22 小陆同学 阅读(4363) 评论(0) 推荐(1) 编辑

git--不小心推代码到master之后,怎么办?

摘要: 获取commit id git log 确定你要回滚到哪个版本 git reset --hard commit_id git push origin master --force 成功! 报错:remote: GitLab: You are not allowed to force push cod 阅读全文

posted @ 2020-08-28 20:20 小陆同学 阅读(1647) 评论(0) 推荐(1) 编辑

python--向钉钉群发送消息(亲测可用)

摘要: 向钉钉群发送文本消息 def sendDingDing(self,text): print(text) headers = {'Content-Type': 'application/json'} webhook = "https://oapi.dingtalk.com/robot/send?acc 阅读全文

posted @ 2020-08-28 20:16 小陆同学 阅读(2699) 评论(0) 推荐(0) 编辑