自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 sqlalchemy

with app.request_context(environ): db.session.query(User).filter(User.id==1).update({"name":"python"}) db.session.commit() print(db.session.query(User).get(1).name) # 事务 user = User(mobile="13412341230", name="python111") db.sessi.

2021-11-25 00:38:52 730

原创 GIT使用

安装gityum -y install gitgit使用# 创建仓库git init# 配置个人信息git config user.name '张三'git config user.email 'zhangsan@163.com'​# 查看git状态git status​# 添加到暂存区git add .git add demo.py​# 添加到仓库git commit -m "描述信息"​# 查看历史版本git loggit reflog​# 记住密

2021-11-22 00:16:03 101

原创 python 与 ES 交互

elasticsearch python客户端使用https://elasticsearch-py.readthedocs.io/en/master/>pip install elasticsearch对于elasticsearch 5.x 版本 需要按以下方式导入from elasticsearch5 import Elasticsearch# elasticsearch集群服务器的地址ES = [ '127.0.0.1:9200']# 创建elastics

2021-11-21 20:30:10 1463

原创 ES 查询

查询1 基本查询 根据文档ID curl -X GET 127.0.0.1:9200/articles/article/1 curl -X GET 127.0.0.1:9200/articles/article/1?_source=title,user_id curl -X GET 127.0.0.1:9200/articles/article/1?_source=false 查询所有 curl -X GET 127.0.0.1:9200/articles/

2021-11-21 20:08:14 141

原创 Logstash导入数据

使用logstash 导入工具从mysql中导入数据Logstach安装sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch在 /etc/yum.repos.d/ 中创建logstash.repo文件[logstash-6.x]name=Elastic repository for 6.x packagesbaseurl=https://artifacts.elastic.co/packages/6

2021-11-21 19:21:24 284

原创 Elasticsearch使用

索引与类型索引查看索引curl 127.0.0.1:9200/_cat/indices请求curl 127.0.0.1:9200/_cat可获取用于查询的名称创建索引索引可以在添加文档数据时,通过动态映射的方式自动生成索引与类型。索引也可以手动创建,通过手动创建,可以控制主分片数目、分析器和类型映射。PUT /my_index{ "settings": { ... any settings ... }, "mappings": {

2021-11-21 19:03:10 119

原创 centos 安装 mysql

wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpmyum -y install mysql57-community-release-el7-10.noarch.rpmyum -y install mysql-community-serversystemctl start mysqld.servicesystemctl status mysqld.service# 取消开机启动syste.

2021-09-01 21:32:59 74

原创 修改 centos 的防火墙状态

# 查看防火墙状态firewall-cmd --state# 停止firewallsystemctl stop firewalld.service# 禁止firewall开机启动systemctl disable firewalld.service

2021-09-01 21:23:22 77

原创 修改centos的启动级别

# 启动级别分类init level systemctl target0 shutdown.target1 emergency.target2 rescure.target3 multi-user.target4 无5 .

2021-09-01 21:22:10 372

原创 django 远程连接数据库报错 1130-host ... is not allowed to connect to this MySql server

mysql -u root -puse mysql;show tables;select Host, User from user;Host:update user set Host='%' where User='root';flush privileges;

2021-09-01 21:18:23 815

原创 安装 redis

cd /rootyum install -y gcc wget http://download.redis.io/releases/redis-5.0.3.tar.gztar -zxvf redis-5.0.3.tar.gzcd redis-5.0.3make -j2# make MALLOC=libcmake install PREFIX=/usr/local/redis# 添加配置文件cp -r redis.conf /usr/local/redis/bin/# 验证安装cd /.

2021-09-01 21:16:49 170

原创 centos 安装 docker

yum update -y# 卸载原有的dockeryum remove docker docker-common docker-selinux docker-engine# 安装依赖yum install -y yum-utils device-mapper-persistent-data lvm2 -y# 添加docker源yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.re.

2021-09-01 21:14:34 53

原创 豆瓣动态抓取

# ecoding:utf-8import requestsimport randomimport timefrom fake_useragent import UserAgentfrom lxml import etreefrom requests.packages.urllib3.exceptions import InsecureRequestWarningrequests.packages.urllib3.disable_warnings(InsecureRequestWarnin.

2021-08-29 12:03:56 122

原创 爬取有道翻译

import requestsimport timeimport randomfrom hashlib import md5def get_useragent(): # from fake_useragent import UserAgent # ua = UserAgent() # user_name = ua.random user_agent = [ "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebK.

2021-08-28 00:16:22 221

原创 centos配置IP

vi /etc/sysconfig/network-scripts/ifcfg-eth0# 配置静态IPIPADDR=192.168.3.10NETMASK=255.255.255.0GATEWAY=192.168.3.1BOOTPROTO=static -->IP方式ONBOOT=yes -->开机自启# 配置动态IPBOOTPROTO=dhcp -->IP方式ONBOOT=yes -->开机自启# 重启网络ifdown eth0ifstat eth0.

2021-08-27 22:08:24 100

原创 安装sqlite3

# DJANGO.CORE.EXCEPTIONS.IMPROPERLYCONFIGURED: SQLITE 3.9.0 OR LATER IS REQUIRED (FOUND 3.7.17).mkdir -p /usr/local/sqlite && cd /usr/local/sqlitewget https://www.sqlite.org/2021/sqlite-autoconf-3350500.tar.gztar -zxvf sqlite-autoconf-3350500.t.

2021-08-27 22:07:20 137

原创 配置python虚拟环境

# 必须要设置,不然后面的环境安装会报错,但是设置后centos的yum将不能使用,yum依赖python2# 更新pippip3 install --upgrade pipll /usr/bin/python*ln -s /usr/bin/python3 /usr/bin/python# 输入python检查版本python# 安装虚拟环境pip3 install virtualenv -i https://pypi.tuna.tsinghua.edu.cn/simple pip3 .

2021-08-27 22:06:25 105

原创 安装python3

wget https://www.python.org/ftp/python/3.6.14/Python-3.6.14.tgzmkdir -p /usr/local/python3.6.14tar -xvf Python-3.6.14.tgz# 安装依赖yum -y install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel wget vim cd Python-3.6.14/./co.

2021-08-27 22:04:32 181

原创 抓取免费代理

import requestsfrom fake_useragent import UserAgentimport timeimport randomfrom lxml import etreeua = UserAgent()url = "https://www.kuaidaili.com/free/inha/{}/"def get_headers(): s = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537..

2021-08-27 22:00:50 92

空空如也

空空如也

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

TA关注的人

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