From 86e5a498820c8f0312405593033fa9b0590f1478 Mon Sep 17 00:00:00 2001 From: yugasun Date: Wed, 2 Sep 2020 16:31:47 +0800 Subject: [PATCH 1/2] fix: update tencnet-component-toolkit for api mark --- README.en.md | 120 --------------------------------------- README.md | 20 ++++--- serverless.component.yml | 2 +- src/package.json | 2 +- 4 files changed, 15 insertions(+), 129 deletions(-) delete mode 100755 README.en.md diff --git a/README.en.md b/README.en.md deleted file mode 100755 index 5e92dc1..0000000 --- a/README.en.md +++ /dev/null @@ -1,120 +0,0 @@ -[![Serverless Python Flask Tencent Cloud](https://img.serverlesscloud.cn/20191226/1577347052683-flask_%E9%95%BF.png)](http://serverless.com) - -# Tencent Flask Serverless Component - -[简体中文](./README.md) | English - -## Introduction - -Tencent [Flask](https://github.com/pallets/flask) Serverless Component, support Restful API deploy, not supportting Flask command. - -## Content - -1. [Prepare](#0-prepare) -1. [Install](#1-install) -1. [Create](#2-create) -1. [Configure](#3-configure) -1. [Deploy](#4-deploy) -1. [Remove](#5-Remove) - -### 0. Prepare - -Before using this component, you need create a flask project, then add `Flask` and `werkzeug` in `requirements.txt`. Like below: - -```txt -Flask==1.0.2 -werkzeug==0.16.0 -``` - -Then create your API service entry file `app.py`, below is a example: - -```python -from flask import Flask, jsonify -app = Flask(__name__) - -@app.route("/") -def index(): - return "Hello Flash" - -@app.route("/users") -def users(): - users = [{'name': 'test1'}, {'name': 'test2'}] - return jsonify(data=users) - -@app.route("/users/") -def user(id): - return jsonify(data={'name': 'test1'}) -``` - -### 1. Install - -Install the Serverless Framework globally: - -```shell -$ npm install -g serverless -``` - -### 2. Create - -Just create the following simple boilerplate: - -```shell -$ touch serverless.yml -$ touch .env # your Tencent api keys -``` - -Add the access keys of a [Tencent CAM Role](https://console.cloud.tencent.com/cam/capi) with `AdministratorAccess` in the `.env` file, using this format: - -``` -# .env -TENCENT_SECRET_ID=XXX -TENCENT_SECRET_KEY=XXX -``` - -- If you don't have a Tencent Cloud account, you could [sign up](https://intl.cloud.tencent.com/register) first. - -### 3. Configure - -```yml -# serverless.yml - -component: flask -name: flashDemo -org: orgDemo -app: appDemo -stage: dev - -inputs: - src: - hook: 'pip install -r requirements.txt -t ./' - dist: ./ - exclude: - - .env - region: ap-guangzhou - runtime: Python3.6 - apigatewayConf: - protocols: - - http - - https - environment: release -``` - -- [More Options](./docs/configure.md)) - -### 4. Deploy - -```shell -$ sls --debug -``` - -  - -### 5. Remove - -```shell -$ sls remove --debug -``` - -### More Components - -Checkout the [Serverless Components](https://github.com/serverless/components) repo for more information. diff --git a/README.md b/README.md index 288a87d..9af2449 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # 腾讯云 Flask Serverless Component -简体中文 | [English](./README.en.md) +简体中文 | [English](https://github.com/serverless-components/tencent-flask/tree/master/README.en.md) ## 简介 @@ -51,7 +51,7 @@ def user(id): 通过 npm 全局安装 [serverless cli](https://github.com/serverless/serverless) -```shell +```bash $ npm install -g serverless ``` @@ -59,7 +59,7 @@ $ npm install -g serverless 本地创建 `serverless.yml` 文件,在其中进行如下配置 -```shell +```bash $ touch serverless.yml ``` @@ -87,7 +87,7 @@ inputs: environment: release ``` -- [更多配置](./docs/configure.md) +- [更多配置](https://github.com/serverless-components/tencent-flask/tree/master/docs/configure.md) ### 3. 部署 @@ -95,7 +95,7 @@ inputs: 通过 `sls` 命令进行部署,并可以添加 `--debug` 参数查看部署过程中的信息 -```shell +```bash $ sls --debug ``` @@ -103,7 +103,7 @@ $ sls --debug 通过以下命令移除部署的 API 网关 -```shell +```bash $ sls remove --debug ``` @@ -111,7 +111,7 @@ $ sls remove --debug 当前默认支持 CLI 扫描二维码登录,如您希望配置持久的环境变量/秘钥信息,也可以本地创建 `.env` 文件 -```shell +```bash $ touch .env # 腾讯云的配置信息 ``` @@ -130,3 +130,9 @@ TENCENT_SECRET_KEY=123 ### 更多组件 可以在 [Serverless Components](https://github.com/serverless/components/blob/master/README.cn.md) repo 中查询更多组件的信息。 + +## License + +MIT License + +Copyright (c) 2020 Tencent Cloud, Inc. diff --git a/serverless.component.yml b/serverless.component.yml index 64f32f8..708d905 100644 --- a/serverless.component.yml +++ b/serverless.component.yml @@ -1,5 +1,5 @@ name: flask -version: 0.0.6 +version: 0.0.7 author: Tencent Cloud, Inc org: Tencent Cloud, Inc description: Deploy a serverless Flask application onto Tencent SCF and API Gateway. diff --git a/src/package.json b/src/package.json index a53fc4f..9931624 100644 --- a/src/package.json +++ b/src/package.json @@ -1,7 +1,7 @@ { "dependencies": { "download": "^8.0.0", - "tencent-component-toolkit": "^1.15.7", + "tencent-component-toolkit": "^1.16.3", "type": "^2.0.0" } } From e0de41d5960a32b234750c3b4e3500bc14adbbaa Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 2 Sep 2020 08:34:01 +0000 Subject: [PATCH 2/2] chore(release): version 0.0.7 ## [0.0.7](https://github.com/serverless-components/tencent-flask/compare/v0.0.6...v0.0.7) (2020-09-02) ### Bug Fixes * update tencnet-component-toolkit for api mark ([86e5a49](https://github.com/serverless-components/tencent-flask/commit/86e5a498820c8f0312405593033fa9b0590f1478)) --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6353356..5555623 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.0.7](https://github.com/serverless-components/tencent-flask/compare/v0.0.6...v0.0.7) (2020-09-02) + + +### Bug Fixes + +* update tencnet-component-toolkit for api mark ([86e5a49](https://github.com/serverless-components/tencent-flask/commit/86e5a498820c8f0312405593033fa9b0590f1478)) + ## [0.0.6](https://github.com/serverless-components/tencent-flask/compare/v0.0.5...v0.0.6) (2020-09-02)