Serverless + Python
简介
serverlessplus 是一个简单易用的工具,它可以帮助你将现有的 django / flask 等框架构建的应用借助 API 网关 迁移到 腾讯云无服务云函数(Tencent Cloud Serverless Cloud Function)上。
开始使用
$ python3 -m pip install serverlessplus
假设有如下 flask 应用:
# app.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'hello world'
添加 index.py 作为服务的入口文件, 内容如下:
# encoding: utf8
from serverlessplus import create_environ, create_app, get_response, wrap_response
# specify entrypoint, `${file_name}:${callable_object}`
APP = 'app:app'
app = create_app(APP)
def main_handler(event, context):
environ = create_environ(event, context)
response = get_response(app, environ)
return wrap_response(response, {'binary_mime_types': ['image/png']})
示例
支持的框架
serverlessplus 被设计为通过 WSGI 与框架进行交互. 理论上, 只要框架支持 WSGI, 就可以使用 serverlessplus
路线图
- 更多 Web 框架的支持与测试
serverlessplus 处于活跃开发中,API 可能在未来的版本中发生变更,我们十分欢迎来自社区的贡献,你可以通过 pull request 或者 issue 来参与。
Metadata
Release files for serverlessplus 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| serverlessplus-0.0.8.tar.gz | 7.4 kB | Without provenance | Details for serverlessplus-0.0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| serverlessplus-0.0.8-py3-none-any.whl | Python 3 | none | any | Details for serverlessplus-0.0.8-py3-none-any.whl |
Total release size: 15.3 kB
Release files / serverlessplus-0.0.8.tar.gz
| Download URL | serverlessplus-0.0.8.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f593f80908f03a14cb76a9770d80eb93ef7cd3afb7fb58410d72145108194cda
|
|
BLAKE2b-256 checksum How to use checksums |
84b93fb0c91558ab3769f89c86c9529df416bce19850e541162fbcf580f2eea3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
|
Release files / serverlessplus-0.0.8-py3-none-any.whl
| Download URL | serverlessplus-0.0.8-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6ca6dd905982e4a26217ecc5be7956be67f6b72db4ab17da4c22a1350ed9ac77
|
|
BLAKE2b-256 checksum How to use checksums |
c642ff88201fe1c826148071fe147d296d9e2b132990c40dc8bd14bef6c6761f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
|
Security for serverlessplus 0.0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.