docker pull更换源

前言

每次使用docker pull的时候总是要等待很久,在不翻墙的情况下建议使用国内的源

步骤

阅读更多

树莓派固定ip设置

前言

由于没有多余的屏幕以及鼠标和键盘等外设(就是有也没空间放),所以树莓派只能通过 xshell 连接,先前我是可以连接上的,但是由于 ip 发生了变化所以又要重新连上屏幕查看 ip,但是以后难免还会发生这样的事情。一劳永逸的方法是设置一个固定 ip 这样下次登录就不会发生之前的问题了。

步骤

阅读更多

Github搜索开源项目方式

前言

作为全球最大的同性交友网站,Github 上有很多优秀的开源项目,使用正确的方式搜索可以很方便地找到自己需要的资源。

使用

阅读更多

drf 一次错误排查

前言

在使用最新版本的 DRF 框架时,注册路由阶段报了一个错

“django.core.exceptions.ImproperlyConfigured: The included URLconf ‘bingo.urls’ does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.”

阅读更多

2019和2020

前言

2019年总体来说还是有所收获的,除了技术上成长了许多,还开发了自己的博客;另外还参与了 Pycon China2019 成都 的志愿者活动,有机会和各位大佬近距离接触

志愿者和讲师合影,阿里老哥、日本小姐姐以及 Flask 项目大神维护者的讲解让小生受益匪浅。

阅读更多

Elasticsearch组合查询

准备数据

POST lagou/testjob/_bulk
{"index":{"_id":1}}
{"salary":10, "title": "Python"}
{"index":{"_id":2}}
{"salary":20, "title": "Scrapy"}
{"index":{"_id":3}}
{"salary":30, "title": "Django"}
{"index":{"_id":4}}
{"salary":40, "title": "Elasticsearch"}

组合查询

阅读更多

Elasticsearch基本查询

准备数据

# 添加映射  
PUT lagou
{
  "mappings": {
    "job":{
      "properties": {
        "title":{
          "store": true,
          "type": "text",
          "analyzer": "ik_max_word"
        },
        "company_name":{
          "store": true,
          "type": "keyword"
        },
        "desc":{
          "type": "text"
        },
        "comments":{
          "type": "integer"
        },
        "add_time":{
          "type": "date",
          "format": "yyyy-MM-dd"
        }
      }
    }
  }
}

POST lagou/job/
{
    "title":"python django 开发工程师",
    "company_name":"美团科技有限公司",
    "desc":"对django的概念熟悉,熟悉python基础知识",
    "comments":20,
    "add_time":"2019-5-30"
}

POST lagou/job/
{
    "title":"python scrapy redis分布式爬虫基本",
    "company_name":"百度科技有限公司",
    "desc":"scrapy的概念熟悉,熟悉redis基础知识",
    "comments":5,
    "add_time":"2019-5-1"
}

POST lagou/job/
{
    "title":"elasticsearch打造搜索引擎",
    "company_name":"阿里巴巴科技有限公司",
    "desc":"熟悉数据结构算法,熟悉python基础开发",
    "comments":60,
    "add_time":"2019-4-15"
}

POST lagou/job/
{
    "title":"python打造推荐引擎系统",
    "company_name":"阿里巴巴科技有限公司",
    "desc":"熟悉推荐引擎的原理以及算法,掌握C语言",
    "comments":60,
    "add_time":"2019-1-22"
}

查询

阅读更多