{"id":17932905,"url":"https://github.com/serverlessplus/py","last_synced_at":"2025-03-24T06:31:36.528Z","repository":{"id":57465864,"uuid":"178969361","full_name":"serverlessplus/py","owner":"serverlessplus","description":"serverless your django/flask apps","archived":false,"fork":false,"pushed_at":"2019-04-10T00:08:01.000Z","size":20,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-19T03:01:26.433Z","etag":null,"topics":["apigateway","django","flask","scf","serverless","tencent-cloud"],"latest_commit_sha":null,"homepage":"http://serverless.plus","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/serverlessplus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-02T00:39:29.000Z","updated_at":"2024-02-21T04:03:23.000Z","dependencies_parsed_at":"2022-09-19T08:31:27.560Z","dependency_job_id":null,"html_url":"https://github.com/serverlessplus/py","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverlessplus%2Fpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverlessplus%2Fpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverlessplus%2Fpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverlessplus%2Fpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serverlessplus","download_url":"https://codeload.github.com/serverlessplus/py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245222604,"owners_count":20580192,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apigateway","django","flask","scf","serverless","tencent-cloud"],"created_at":"2024-10-28T21:34:11.115Z","updated_at":"2025-03-24T06:31:33.873Z","avatar_url":"https://github.com/serverlessplus.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://github.com/serverlessplus/py/raw/master/serverless%2B.png)\n\n# Serverless + Python\n\n## 简介\n\n`serverlessplus` 是一个简单易用的工具，它可以帮助你将现有的 `django` / `flask` 等框架构建的应用借助 [API 网关](https://cloud.tencent.com/product/apigateway) 迁移到 [腾讯云无服务云函数](https://cloud.tencent.com/product/scf)（Tencent Cloud Serverless Cloud Function）上。\n\n## 开始使用\n\n```shell\n$ python3 -m pip install serverlessplus\n```\n\n假设有如下 `flask` 应用：\n```python\n# app.py\nfrom flask import Flask\n\napp = Flask(__name__)\n\n@app.route('/')\ndef hello():\n    return 'hello world'\n```\n\n添加 `index.py` 作为服务的入口文件, 内容如下：\n```python\n# encoding: utf8\nfrom serverlessplus import create_environ, create_app, get_response, wrap_response\n\n# specify entrypoint, `${file_name}:${callable_object}`\nAPP = 'app:app'\napp = create_app(APP)\n\ndef main_handler(event, context):\n    environ = create_environ(event, context)\n    response = get_response(app, environ)\n    return wrap_response(response, {'binary_mime_types': ['image/png']})\n```\n\n## 示例\n\n- [flask 示例](https://github.com/serverlessplus/flask-example)\n- [django 示例](https://github.com/serverlessplus/django-example)\n\n## 支持的框架\n\n`serverlessplus` 被设计为通过 `WSGI` 与框架进行交互. 理论上, 只要框架支持 `WSGI`, 就可以使用 `serverlessplus`\n\n## 路线图\n\n- 更多 Web 框架的支持与测试\n\n`serverlessplus` 处于活跃开发中，`API` 可能在未来的版本中发生变更，我们十分欢迎来自社区的贡献，你可以通过 pull request 或者 issue 来参与。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserverlessplus%2Fpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserverlessplus%2Fpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserverlessplus%2Fpy/lists"}