06 2020 档案

摘要:一、装饰器是什么 python的装饰器本质上是一个Python函数,它可以让其他函数在不需要做任何代码变动的前提下增加额外功能,装饰器的返回值也是一个函数对象。简单的说装饰器就是一个用来返回函数的函数。 它经常用于有切面需求的场景,比如:插入日志、性能测试、事务处理、缓存、权限校验等场景。装饰器是解 阅读全文
posted @ 2020-06-19 10:21 John-Python 阅读(467) 评论(0) 推荐(0) 编辑
摘要:import time def count_time(func): def wrapper(*args, **kwargs): start_time = time.time() count = func(*args, **kwargs) print('程序共计%s秒' % (time.time() 阅读全文
posted @ 2020-06-19 10:12 John-Python 阅读(132) 评论(0) 推荐(0) 编辑
摘要:Nginx配置文件(/usr/local/nginx/conf/nginx.conf)主要由四部分组成:main(全区设置),server(主机配置),upstream(负载均衡服务器设置),和location(URL匹配特定位置设置) #定义nginx运行的用户和用户组 user www www; 阅读全文
posted @ 2020-06-15 18:13 John-Python 阅读(561) 评论(0) 推荐(0) 编辑
摘要:解决方法: use mysql;ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '复杂一点的密码'; flush privileges; 阅读全文
posted @ 2020-06-11 14:22 John-Python 阅读(1806) 评论(0) 推荐(0) 编辑
摘要:SSH 最常用的登陆方法是ssh username@server -p port 本文将通过~/.ssh/confg配置文件,实现免密、更改名称的登陆方法,不论你的username、server address、port是什么,都可以不用输入,只需要输入一个替换的名称即可登陆该服务器。像这样ssh 阅读全文
posted @ 2020-06-11 10:36 John-Python 阅读(9347) 评论(0) 推荐(0) 编辑
摘要:在开发过程中,当需要使用python的包时可以联网安装 sudo pip3 install 包名称 使用如上命令,会将包安装到/usr/local/lib/python3.5/dist-packages下。 产生的问题 如果在一台机器上,想开发多个不同的项目,需要用到同一个包的不同版本,如果还使用上 阅读全文
posted @ 2020-06-10 18:33 John-Python 阅读(203) 评论(0) 推荐(0) 编辑
摘要:pip install -i https://pypi.doubanio.com/simple/ -r requirements.txt 单独使用豆瓣源安装第三方模块:pip install django -i https://pypi.doubanio.com/simple/ 一劳永逸的做法:换源 阅读全文
posted @ 2020-06-03 10:41 John-Python 阅读(1496) 评论(0) 推荐(0) 编辑
摘要:1.安装相关依赖库(工具包) yum install gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel 阅读全文
posted @ 2020-06-03 10:32 John-Python 阅读(261) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示