serverless your django/flask apps
Project description
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 来参与。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file serverlessplus-0.0.8.tar.gz.
File metadata
- Download URL: serverlessplus-0.0.8.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f593f80908f03a14cb76a9770d80eb93ef7cd3afb7fb58410d72145108194cda
|
|
| MD5 |
18b2003882f053c056a077223b3a3791
|
|
| BLAKE2b-256 |
84b93fb0c91558ab3769f89c86c9529df416bce19850e541162fbcf580f2eea3
|
File details
Details for the file serverlessplus-0.0.8-py3-none-any.whl.
File metadata
- Download URL: serverlessplus-0.0.8-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ca6dd905982e4a26217ecc5be7956be67f6b72db4ab17da4c22a1350ed9ac77
|
|
| MD5 |
d89314c8a7b36d2d13d8cede7268e884
|
|
| BLAKE2b-256 |
c642ff88201fe1c826148071fe147d296d9e2b132990c40dc8bd14bef6c6761f
|