publish

[Custom CLI] Develop and Publish a Node.js CLI from Scratch

心不动则不痛 提交于 2020-03-01 02:43:52
Before you use any frameworks, you should know the fundamentals of what makes Node CLI's tick. Here we explain everything you need to know to write a complete Node.js CLI from scratch, parse arguments, publish it to NPM for users, and set up yarn symlinks for optimal developer experience. Create a mycli.js file, in the very first line, we will add this code #!/usr/bin/env node It tells the running env. The benenfits for that is in order to run mycli.s file: // Before node ./mycli.js // After ./mycli.js Pass the argv: We also want to pass some information into file, in order to do some

python3操作PyMySQL笔记

巧了我就是萌 提交于 2020-02-29 10:42:20
python3操作mysql需要先安装PyMySQL pip install PyMySQL 在linux登录mysql ,并且在安装数据库时设置了数据库的用户名“root”和密码“root”,mysql安装的版本为mysql5.7 [root@web ~]# mysql -uroot -p -h192.168.10.100 在mysql里面创建一个mysql库 mysql> create database mrsoft; Query OK, 1 row affected (0.00 sec) 下面是新建一个py文件远程创建一个mysql连接,下面通过connect()方法连接MySQL数据库mrsoft,具体代码如下: import pymysql # 打开数据库连接, 参数1:主机名或者ip;参数2:用户名;参数3:密码;参数4:数据库名称;参数5:用utf8格式打开数据库表防止出现中文乱码 db = pymysql.connect("192.168.10.100", "root", "root", "mrsoft", charset="utf8") # 使用cursor()方法创建一个游标对象cursor cursor = db.cursor() # 使用execute()方法执行SQL查询 cursor.execute("SELECT VERSION()") #

DRF之子序列化、model类(四)

会有一股神秘感。 提交于 2020-02-23 00:49:51
一、二次封装Resonse responses.py from rest_framework.response import Response class APIResponse(Response): def __init__(self, status=None, msg=None, http_status=None, *args, **kwargs): data = { 'status': status, 'msg': msg, } if kwargs: data.update(kwargs) super().__init__(status=http_status,data=data) 二、数据库关系分析 ''' 1.相互有关系的两张表,增删改操作会相互影响,导致效率低下,查询操作就是正常的连表操作 2.相互有关的两张表,断开外键关系,但从代码逻辑层面保持原来的联系 - 这样一来,每个表都可以单独操作,提高了增删改查的效率,在开发中要避免由此带来的脏数据,事务 + 代码层面的逻辑约束 - 由于数据没有发生变化,查询的连表操作不会受到影响 3. django的orm支持断关联操作关系表,且所有的操作方式和没有断开关联的操作是一致的(在django2.0以上默认不进行级联更新) ''' 三、orm操作关系 ''' 外键位置: 1.一对多的外键关系,FK毫无疑问建立在多的乙方

快速上手和理解物联网开发平台

孤者浪人 提交于 2020-02-22 16:43:29
快速理解和上手物联网开发平台 文章目录 快速理解和上手物联网开发平台 导读 关于物联网 关于本课程 自我介绍 本文介绍 一、深入了解 MQTT 协议 1.1 MQTT 协议简介与基本概念 1.2 MQTT 主题 1.3 MQTT 控制报文格式 1.3.1 固定报文头 1.3.2 可变报文头 1.3.3 有效负载 1.4 MQTT 控制报文 1.4.1 CONNECT 1.4.2 PUBLISH 1.5 消息服务质量 QoS 1.6 MQTT 与传统 MQ 对比 二、走进 EMQX 2.1 认证访问控制 2.2 插件系统 2.3 共享订阅 2.4 系统主题 2.5 管理监控 API 2.6 EMQX 集群 三、 MQTT Client 库实践 3.1 建立连接 3.2 订阅主题 3.3 发布消息 四、 MySQL 认证和访问控制 4.1 MySQL 认证 4.2 主题设计 4.3 MySQL 访问控制 五、 处理设备上行数据 5.1 共享订阅 5.1.1 共享订阅主题设计 5.1.2 共享订阅客户端权限控制 5.1.3 消息流转 5.1.4 实现 5.2 WebHook 机制 5.3 消息去重 六、下行数据处理方案 七、功能规划和实现 7.1 EMQX 集群 7.2 设备生命周期管理 7.2.1 设备动态注册 7.2.2 设备上下线状态管理 7.2.3 设备删除与禁用 7.3

Django - ModelForm

 ̄綄美尐妖づ 提交于 2020-02-20 07:54:42
一、原生form https://www.cnblogs.com/yuanchenqi/articles/7614921.html 案例: 步骤: 1.models.py ... makemigrations migrate from django.db import models # Create your models here. class Book(models.Model): title = models.CharField(max_length=32) price = models.DecimalField(max_digits=8,decimal_places=2) # 999999.99 date = models.DateField() publish = models.ForeignKey("Publish",on_delete=models.CASCADE) authors = models.ManyToManyField("Author") def __str__(self): return self.title class Publish(models.Model): name = models.CharField(max_length=32) def __str__(self): return self.name class Author(models

modelform的简介

不打扰是莪最后的温柔 提交于 2020-02-20 06:13:54
Form介绍 我们之前在HTML页面中利用form表单向后端提交数据时,都会写一些获取用户输入的标签并且用form标签把它们包起来。 与此同时我们在好多场景下都需要对用户的输入做校验,比如校验用户是否输入,输入的长度和格式等正不正确。如果用户输入的内容有错误就需要在页面上相应的位置显示对应的错误信息.。 Django form组件就实现了上面所述的功能。 总结一下,其实form组件的主要功能如下: 生成页面可用的HTML标签 对用户提交的数据进行校验 保留上次输入内容 普通方式手写图书管理系统的增加书籍和编辑书籍功能 views.py, def book_list(request): book_list = models.Book.objects.all() return render(request, "book_list.html", {"book_list": book_list})def add_book(request): # 获取前端提交的数据 if request.method == "POST": title = request.POST.get("title") price = request.POST.get("price") publish_date = request.POST.get("publish_date") publisher = request

Django中ORM系统多表数据操作

二次信任 提交于 2020-02-18 08:29:46
一,多表操作之增删改查 1.在seting.py文件中配置数据库连接信息 2.创建数据库关联关系models.py from django.db import models # Create your models here. class Book(models.Model): title = models.CharField( max_length=32) pub_date=models.DateField() price=models.DecimalField(max_digits=5,decimal_places=2)  #以book表为基本表创建与出版社表的关联关系关联字段publish_id Django会自动拼接_id publish=models.ForeignKey(to="Publish",to_field="id",on_delete=models.CASCADE,null=True)  #以book表为基本表创建通过与第三方表book2author与author表的多对多关联关系, authors=models.ManyToManyField("Author",db_table="book2authors") # 创建关系表 def __str__(self): return self.title class Publish(models.Model):

Google App is Published on Internal Test Track but Can't Be Found/Downloaded

时光毁灭记忆、已成空白 提交于 2020-02-18 07:02:52
问题 I've successfully completed the publishing process for an APK to the Internal Test Track. But when I try to view the App for download on the Google Play Store using the "VIEW ON GOOGLE PLAY" link in the screenshot below... ...it opens a new window with the following error: I've also tried using the testers link "download it on Google Play." below... ...but it results in the same message stating the App can't be found. This is the first time the App has been published and it's being done on

Google App is Published on Internal Test Track but Can't Be Found/Downloaded

生来就可爱ヽ(ⅴ<●) 提交于 2020-02-18 06:48:52
问题 I've successfully completed the publishing process for an APK to the Internal Test Track. But when I try to view the App for download on the Google Play Store using the "VIEW ON GOOGLE PLAY" link in the screenshot below... ...it opens a new window with the following error: I've also tried using the testers link "download it on Google Play." below... ...but it results in the same message stating the App can't be found. This is the first time the App has been published and it's being done on

grunt构建前端自动化

北慕城南 提交于 2020-02-16 09:23:08
一.grunt是基于nodejs的,所以首先我们需要安装node 二.全局安装grunt 可以参考 http://www.gruntjs.net/docs/getting-started/ 进行安装. 1.全局安装 npm install -g grunt-cli 2.进入当前项目根据配置文件 package.json 进行本地安装,或者直接把以前项目所有用过的本地安装文件直接复制到当前项目使用 3.任务设置 打开gruntfile.js进行设置 module.exports = function (grunt) { // 任务配置,所有插件的配置信息 grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), //1.先清空发布文件夹 clean: { src: ["publish/"] }, //2.复制到发布文件夹 不要破坏源文件 copy: { main: { files: [ { src: 'assets/**', dest: 'publish/' }, // { src: 'assets/*.html', dest: 'publish/assets/' }, ] } }, //3.进行合并 concat: { js:{ dest: 'publish/tmp/concat/js/app.js', src: [