{"id":57664,"date":"2021-03-10T00:01:36","date_gmt":"2021-03-09T16:01:36","guid":{"rendered":"http:\/\/www.zhushiyao.com\/?p=57664"},"modified":"2021-03-10T00:02:28","modified_gmt":"2021-03-09T16:02:28","slug":"424593338d","status":"publish","type":"post","link":"http:\/\/www.zhushiyao.com\/?p=57664","title":{"rendered":"\u5f00\u6e90\u6846\u67b6 Zappa\uff1a\u4e0a\u7ebf Python \u5e94\u7528\u4ec5\u9700\u4e00\u6761\u547d\u4ee4\uff01"},"content":{"rendered":"<div class=\"bpp-post-content\">\n<section style=\"margin-left: 0px; margin-right: 0px;\"><\/section>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; text-align: left;\"><span style=\"font-size: 15px;\">\u4f5c\u8005\uff1aHelloGitHub-\u5431\u5431<\/span><\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u8fd9\u91cc\u662f <strong>HelloGitHub \u63a8\u51fa\u7684\u300a\u8bb2\u89e3\u5f00\u6e90\u9879\u76ee\u300b\u7cfb\u5217<\/strong>\uff0c\u4eca\u5929\u8981\u5411\u5c0f\u4f19\u4f34\u4eec\u4ecb\u7ecd\u4e00\u4e2a Python \u65e0\u670d\u52a1\uff08Serverless\uff09\u6846\u67b6 Zappa\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">Zappa \u8ba9\u6211\u4eec\u53ef\u4ee5\u8f7b\u677e\u90e8\u7f72 Python \u5e94\u7528\u7a0b\u5e8f\uff1a\u4ec5\u9700\u51e0\u6761\u547d\u4ee4\u3001\u6253\u5305\u4ee3\u7801\u3001\u4e0a\u4f20\u4e91\u670d\u52a1\u5668\u3001\u7a0b\u5e8f\u4e0a\u7ebf\uff0cbingo \u4e00\u6c14\u5475\u6210\uff01\u4ece\u6b64\u51cf\u5c11\u90e8\u7f72\u6210\u672c\uff0c\u653e\u4e0b\u8fd0\u7ef4\u7684\u91cd\u62c5\u3002\u4ec5\u9700\u4f60\u6709\u4e00\u70b9\u70b9 Python Web \u57fa\u7840\uff01<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u5b83\u5230\u5e95\u6709\u591a\u4fbf\u6377\uff1f\u4e00\u6761\u547d\u4ee4\u5373\u523b\u90e8\u7f72\uff01<\/p>\n<figure style=\"margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;\"><img decoding=\"async\" style=\"display: block; margin-right: auto; margin-left: auto;\" title=\"\u5f00\u6e90\u6846\u67b6 Zappa\uff1a\u4e0a\u7ebf Python \u5e94\u7528\u4ec5\u9700\u4e00\u6761\u547d\u4ee4\uff01\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2021\/03\/2-1615305696.png\" alt=\"\u5f00\u6e90\u6846\u67b6 Zappa\uff1a\u4e0a\u7ebf Python \u5e94\u7528\u4ec5\u9700\u4e00\u6761\u547d\u4ee4\uff01\" \/><\/figure>\n<blockquote style=\"border-top: none; border-right: none; border-bottom: none; font-size: 0.9em; overflow: auto; color: #6a737d; padding: 10px 10px 10px 20px; margin-bottom: 20px; margin-top: 20px; border-left-color: #ef7060; background: #fff9f9;\">\n<p style=\"font-size: 16px; padding-top: 8px; padding-bottom: 8px; color: black; line-height: 26px;\"><span style=\"letter-spacing: normal; font-size: 13px;\">\u9879\u76ee\u5730\u5740\uff1ahttps:\/\/github.com\/Miserlou\/Zappa<\/span><\/p>\n<\/blockquote>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u4e0b\u9762\u5c31\u8ba9\u6211\u4eec\u52a8\u624b\u6765\u8bd5\u8bd5\u5427\uff01<\/p>\n<h2 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; border-bottom: 2px solid #ef7060; font-size: 1.3em;\"><span style=\"display: inline-block; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e00\u3001\u524d\u8a00<\/span><\/h2>\n<h3 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 20px;\">1.1 \u4ecb\u7ecd Serverless<\/h3>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u521a\u5f00\u7bc7\u4fbf\u63d0\u5230\u4e86\u4e00\u4e2a<span style=\"text-decoration: line-through;\">\u83ab\u540d\u5176\u5999<\/span>\u7684\u540d\u8bcd\uff1a<strong>\u65e0\u670d\u52a1\uff08Serverless\uff09<\/strong>\uff0c\u4e00\u5f00\u59cb\u6211\u4e5f\u662f\u95ee\u53f7\u8138\uff0c\u7ecf\u8fc7\u591a\u65b9\u641c\u8bc1\uff0c\u6211\u4eec\u53ef\u4ee5\u7b80\u5355\u7684\u8ba4\u4e3a Serverless \u662f\u6307\u4e0d\u5fc5\u62c5\u5fc3\u5e95\u5c42\u57fa\u7840\u7ed3\u6784\uff0c\u4e0d\u9700\u8981\u7ba1\u7406\u670d\u52a1\u5668\uff0c\u4ece\u800c\u6765\u6784\u5efa\u548c\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\u3002\u5177\u4f53\u6982\u5ff5\u5c0f\u8bfe\u5802\u5982\u4e0b\uff1a<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">1.1.1 \u4ec0\u4e48\u9b3c\uff1f<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u56de\u5fc6\u4e00\u4e0b\uff0c\u5e73\u65f6\u4e0a\u7ebf\u4e00\u4e2a\u7b80\u5355\u7684 Python Web \u5e94\u7528\u7684\u8fc7\u7a0b\u3002<\/p>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u4e00\u4e2a 24 \u5c0f\u65f6\u4e0d\u95f4\u65ad\u8fd0\u884c\u7684\u670d\u52a1\u5668\uff1a\u6bd4\u5982\u4e91\u4e3b\u673a\uff0c\u7528\u4ee5\u642d\u5efa\u4ee3\u7801\u8fd0\u884c\u73af\u5883\u548c\u8fdb\u884c\u7cfb\u7edf\u914d\u7f6e\uff0c\u7ef4\u6301\u7740\u8fd0\u884c\u6211\u4eec\u7684\u5e94\u7528\uff1b<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u90e8\u7f72 Web \u670d\u52a1\u5668\uff1a\u6211\u4eec\u9700\u8981\u9009\u62e9\u5408\u9002\u7684 Web \u670d\u52a1\u5668\uff0c\u7ecf\u8fc7\u914d\u7f6e\u548c\u542f\u52a8\uff0c\u5b9e\u73b0\u53cd\u5411\u4ee3\u7406\u548c\u8d1f\u8f7d\u5747\u8861\uff1b<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u57df\u540d\u7ed1\u5b9a\uff1a\u6700\u540e\u5982\u679c\u8981\u88ab\u5e7f\u6cdb\u7528\u6237\u8bbf\u95ee\uff0c\u6211\u4eec\u9700\u8981\u6ce8\u518c\u57df\u540d\uff0c\u5e76\u4e14\u7ed1\u5b9a\u5728\u670d\u52a1\u5668\uff1b<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u8fd0\u8425\u7ef4\u62a4\uff1a\u914d\u7f6e\u548c\u542f\u52a8\u5728\u5e94\u7528\u4e0a\u7ebf\u4e4b\u540e\uff0c\u6211\u4eec\u8fd8\u9700\u8981\u7ba1\u7406\u548c\u7ef4\u62a4\u6211\u4eec\u7684\u670d\u52a1\u5668\uff0c\u9884\u9632\u9ed1\u5ba2\u653b\u51fb\uff0c\u5e94\u5bf9\u672a\u6765\u7528\u6237\u8bbf\u95ee\u9ad8\u5cf0\u671f\u3002<\/section>\n<\/li>\n<\/ul>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u800c\u5bf9\u4e8e\u4f7f\u7528 Serverless \u67b6\u6784\u7684\u5e94\u7528\uff0c\u6211\u4eec\u53ea\u9700\u8981\u5173\u5fc3\u6211\u4eec\u7684\u5e94\u7528\u7f16\u5199\u548c\u6838\u5fc3\u4e1a\u52a1\uff0c\u65e0\u9700\u64cd\u5fc3\u4e91\u4e3b\u673a\u3001\u64cd\u4f5c\u7cfb\u7edf\u3001\u8d44\u6e90\u5206\u914d\u548c Web \u670d\u52a1\u5668\u914d\u7f6e\u7b49\u76f8\u5173\u95ee\u9898\uff0c\u65e0\u9700\u8003\u8651\u670d\u52a1\u5668\u7684\u89c4\u683c\u5927\u5c0f\u3001\u5b58\u50a8\u7c7b\u578b\u3001\u7f51\u7edc\u5e26\u5bbd\u3001\u81ea\u52a8\u6269\u7f29\u5bb9\u95ee\u9898\uff0c\u65e0\u9700\u518d\u5bf9\u670d\u52a1\u5668\u8fdb\u884c\u8fd0\u7ef4\u3001\u4e0d\u65ad\u6253\u7cfb\u7edf\u8865\u4e01\u548c\u5e94\u7528\u8865\u4e01\u3001\u65e0\u9700\u8fdb\u884c\u6570\u636e\u5907\u4efd\u7b49\u5de5\u4f5c\u3002\u4e00\u5207\u975e\u6838\u5fc3\u4e1a\u52a1\u90fd\u5916\u5305\u7ed9\u4e86\u516c\u5171\u4e91\u8425\u8fd0\u5546\uff0c\u8ba9\u5f00\u53d1\u4eba\u5458\u4ece\u590d\u6742\u7684\u90e8\u7f72\u548c\u8fd0\u7ef4\u73af\u5883\u4e2d\u8131\u8eab\u51fa\u6765\uff0c\u4e13\u6ce8\u4e8e\u4e1a\u52a1\u672c\u8eab\u7684\u4ef7\u503c\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u7528 Zappa \u91cc\u7684\u4e00\u53e5\u8bdd\u8bf4\u5c31\u662f <strong>\u201cwithout any permanent infrastructure\u201d<\/strong>\uff08\u65e0\u9700\u4efb\u4f55\u6c38\u4e45\u6027\u57fa\u7840\u8bbe\u65bd\uff09\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u6572\u9ed1\u677f\uff0c\u5c3d\u7ba1\u4ece\u540d\u5b57\u4e0a\u8bf4\u662f Serverless\uff0c\u4f46\u662f\u4ecd\u7136\u9700\u8981\u7269\u7406\u670d\u52a1\u5668\uff0c\u53ea\u662f\u6211\u4eec\u5f00\u53d1\u4eba\u5458\u6210\u4e86\u7529\u624b\u638c\u67dc\u3002<\/p>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">1.1.2 \u597d\u5904\u6709\uff1f<\/h4>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u964d\u4f4e\u8fd0\u7ef4\u9700\u6c42\u548c\u7ef4\u62a4\u6210\u672c\uff1b<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u5b8c\u5168\u81ea\u52a8\u5316\u7684\u5f39\u6027\u6269\u5bb9\u548c\u7f29\u5bb9\uff1a\u5728\u4e1a\u52a1\u9ad8\u5cf0\u671f\u65f6\uff0c\u4ea7\u54c1\u7684\u8ba1\u7b97\u80fd\u529b\u548c\u5bb9\u91cf\u81ea\u52a8\u6269\u5927\uff0c\u627f\u8f7d\u66f4\u591a\u7684\u7528\u6237\u8bf7\u6c42\uff1b\u53cd\u4e4b\uff0c\u5728\u4e1a\u52a1\u4e0b\u964d\u65f6\uff0c\u6240\u4f7f\u7528\u7684\u8d44\u6e90\u4e5f\u4f1a\u540c\u65f6\u6536\u7f29\uff0c\u907f\u514d\u8d44\u6e90\u6d6a\u8d39\uff1b<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u8282\u7701\u5f00\u652f\uff0c\u5168\u65b0\u7684\u8ba1\u91cf\u8ba1\u8d39\u6a21\u5f0f\uff1a\u5f00\u53d1\u8005\u4ec5\u9700\u6839\u636e\u4f7f\u7528\u91cf\u6765\u4ed8\u8d39\u3002\u5728\u65e0\u4e1a\u52a1\u91cf\u7684\u60c5\u51b5\u4e0b\uff0c\u4e0d\u4f1a\u6709\u7a7a\u95f2\u8d44\u6e90\u5360\u7528\uff0c\u4e5f\u4e0d\u4f1a\u6709\u8d39\u7528\u4ea7\u751f\u3002<\/section>\n<\/li>\n<\/ul>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">1.1.3 \u666e\u904d\u8ba4\u4e3a Serverless = FaaS + BaaS<\/h4>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">BaaS\uff08Backedn as a Service \u540e\u7aef\u5373\u670d\u52a1\uff09<\/section>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px; color: black; list-style-type: square;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u540e\u7aef\uff0c\u6307\u7684\u5c31\u662f\u5404\u79cd\u4e91\u4ea7\u54c1\u548c\u4e91\u670d\u52a1\uff0c\u4f8b\u5982\u5bf9\u8c61\u5b58\u50a8 OS \uff0c\u6d88\u606f\u961f\u5217 MQ\uff0c\u4e91\u6570\u636e\u5e93 DB\uff0c\u4e91\u7f13\u5b58 Redis\u4ee5\u53ca\u5404\u79cd\u4ee5 API \u5f62\u5f0f\u63d0\u4f9b\u7684\u670d\u52a1\u3002\u7528\u6237\u76f4\u63a5\u5f00\u901a\u5373\u53ef\u4f7f\u7528\uff0c\u65e0\u9700\u8003\u8651\u90e8\u7f72\u3001\u6269\u5bb9\u3001\u5907\u4efd\u3001\u5b89\u5168\u7b49\u5404\u79cd\u8fd0\u7ef4\u5de5\u4f5c\u3002<\/section>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">FaaS\uff08Functions as a Service \u51fd\u6570\u5373\u670d\u52a1\uff09<\/section>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px; color: black; list-style-type: square;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u662f Serverless \u7684\u6838\u5fc3\uff0c\u8ba9\u7528\u6237\u4ec5\u9700\u7f16\u5199\u548c\u4e0a\u4f20\u6838\u5fc3\u4e1a\u52a1\u4ee3\u7801\uff0c\u4ea4\u7531\u5e73\u53f0\u5b8c\u6210\u90e8\u7f72\u3001\u8c03\u5ea6\u3001\u6d41\u91cf\u5206\u53d1\u548c\u5f39\u6027\u4f38\u7f29\u7b49\u80fd\u529b\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e00\u79cd\u65b0\u7684\u65b9\u5f0f\u6765\u63d0\u4f9b\u8ba1\u7b97\u8d44\u6e90\uff0c\u8fdb\u4e00\u6b65\u964d\u4f4e\u4e91\u8ba1\u7b97\u7684\u4f7f\u7528\u95e8\u69db\u3002<\/section>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 18px;\">1.1.4 AWS Lambda<\/h4>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u5728\u8be5\u9879\u76ee\u4e2d\uff0c\u4f38\u624b\u767dpiao AWS \u6d77\u5916\u533a\u57df\u8d26\u6237\u514d\u8d39 AWS Lambda \u5957\u9910\u3002AWS Lambda \u4f5c\u4e3a Serverless \u6700\u65e9\u7684\u6846\u67b6\u4ea7\u54c1\u7531\u4e9a\u9a6c\u900a\u57282014\u5e74\u63a8\u51fa\uff0c\u662f\u4e00\u79cd\u65e0\u670d\u52a1\u5668\u7684\u8ba1\u7b97\u670d\u52a1\uff0c\u65e0\u9700\u9884\u7f6e\u6216\u7ba1\u7406\u670d\u52a1\u5668\u5373\u53ef\u8fd0\u884c\u4ee3\u7801\u3002Lambda \u51e0\u4e4e\u53ef\u4ee5\u4e3a\u4efb\u4f55\u7c7b\u578b\u7684\u5e94\u7528\u7a0b\u5e8f\u6216\u540e\u7aef\u670d\u52a1\u8fd0\u884c\u4ee3\u7801\uff0c\u6211\u4eec\u53ea\u9700\u4e0a\u4f20\u76f8\u5e94\u7684\u4ee3\u7801\uff0c\u5b83\u4f1a\u5904\u7406\u8fd0\u884c\u548c\u6269\u5c55\u4ee3\u7801\u6240\u9700\u7684\u4e00\u5207\u5de5\u4f5c\u3002<\/p>\n<figure style=\"margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;\"><img decoding=\"async\" style=\"display: block; margin-right: auto; margin-left: auto;\" title=\"\u5f00\u6e90\u6846\u67b6 Zappa\uff1a\u4e0a\u7ebf Python \u5e94\u7528\u4ec5\u9700\u4e00\u6761\u547d\u4ee4\uff01\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2021\/03\/6-1615305696.png\" alt=\"\u5f00\u6e90\u6846\u67b6 Zappa\uff1a\u4e0a\u7ebf Python \u5e94\u7528\u4ec5\u9700\u4e00\u6761\u547d\u4ee4\uff01\" \/><\/figure>\n<h3 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 20px;\">1.2 Python \u7684 Serverless \u6846\u67b6<\/h3>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u672c\u7bc7\u6587\u7ae0\u7684\u4e3b\u89d2\uff1aZappa \u767b\u573a\uff01\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7 Zappa \u5de5\u5177\u4f53\u9a8c\u4e00\u4e0b Serverless \u6280\u672f\uff0c\u7528\u5b83\u5b9e\u73b0\u6211\u4eec Python \u5e94\u7528\u7a0b\u5e8f\u7684\u65e0\u670d\u52a1\u5668\u90e8\u7f72\uff0c\u521d\u6b65\u4f53\u9a8c\u65e0\u9650\u4f38\u7f29\u6269\u5c55\u3001\u96f6\u5b95\u673a\u3001\u96f6\u7ef4\u62a4\u7684\u5feb\u6377\u3002\u6709\u4e86 Zappa\uff0c\u6211\u4eec\u65e0\u9700\uff1a<\/p>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\"><strong style=\"color: black;\">\u914d\u7f6e<\/strong> Web \u670d\u52a1\u5668<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\"><strong style=\"color: black;\">\u4ed8\u8d39<\/strong> 24\/7 \u670d\u52a1\u5668\u7684\u6b63\u5e38\u8fd0\u884c\u65f6\u95f4<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\"><strong style=\"color: black;\">\u62c5\u5fc3<\/strong>\u8d1f\u8f7d\u5e73\u8861\u548c\u53ef\u6269\u5c55\u6027<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\"><strong style=\"color: black;\">\u4fdd\u6301<\/strong>\u81ea\u5df1\u7684\u670d\u52a1\u5668\u65f6\u523b\u5728\u7ebf\u72b6\u6001<\/section>\n<\/li>\n<\/ul>\n<h2 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; border-bottom: 2px solid #ef7060; font-size: 1.3em;\"><span style=\"display: inline-block; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e8c\u3001\u4eb2\u81ea\u52a8\u624b<\/span><\/h2>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u5b9e\u6218\u65f6\u95f4\uff1a\u5df2\u7ecf\u5b9e\u9a8c\uff08\u8e29\u5751\uff09\u6210\u529f\uff08\u4e0d\u65ad\uff09\u7684\u6211\u5c31\u6765\u5206\u4eab\u90e8\u7f72\u4e00\u4e2a\u7b80\u5355\u7684 <code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">Flask<\/code> \u5e94\u7528\u7684\u8fc7\u7a0b\uff0c\u4e0d\u8981\u62c5\u5fc3\u8ddf\u7740\u505a\u4f60\u4e5f\u53ef\u4ee5~<\/p>\n<h3 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 20px;\">2.1 \u73af\u5883<\/h3>\n<ol class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">Python\u7248\u672c\u8981\u6c42\uff1a3.6\/3.7\/3.8<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\u6d4b\u8bd5\u7cfb\u7edf\uff1aUbuntu 18.04.4 LTS<\/section>\n<\/li>\n<\/ol>\n<h3 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 20px;\">2.2 \u51c6\u5907<\/h3>\n<ol class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\"><strong>\u4fdd\u8bc1<\/strong>\u81ea\u5df1\u7684\u9879\u76ee\u662f\u8fd0\u884c\u5728\u865a\u62df\u73af\u5883\u4e0b\u3002<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\"><span style=\"color: #998; font-style: italic; line-height: 26px;\">#\u00a0\u9700\u8981\u5b89\u88c5\u00a0Python\u00a03.x\u00a0\u7248\u672c<\/span><br \/>python\u00a0--version<br \/><br \/><span style=\"color: #998; font-style: italic; line-height: 26px;\">#\u00a0\u5b89\u88c5\u00a0Pipenv<\/span><br \/>pip\u00a0install\u00a0--user\u00a0pipenv<br \/><br \/><span style=\"color: #998; font-style: italic; line-height: 26px;\">#\u00a0\u8fdb\u5165\u81ea\u5df1\u7684\u9879\u76ee<\/span><br \/><span style=\"color: #0086b3; line-height: 26px;\">cd<\/span>\u00a0demo<br \/><br \/><span style=\"color: #998; font-style: italic; line-height: 26px;\">#\u00a0\u5b9e\u4f8b\u5316\u00a0pipfile\u00a0\u548c\u00a0venv<\/span><br \/>pipenv\u00a0shell<br \/><\/code><\/pre>\n<figure style=\"margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;\"><img decoding=\"async\" style=\"display: block; margin-right: auto; margin-left: auto;\" title=\"\u5f00\u6e90\u6846\u67b6 Zappa\uff1a\u4e0a\u7ebf Python \u5e94\u7528\u4ec5\u9700\u4e00\u6761\u547d\u4ee4\uff01\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2021\/03\/3-1615305696.png\" alt=\"\u5f00\u6e90\u6846\u67b6 Zappa\uff1a\u4e0a\u7ebf Python \u5e94\u7528\u4ec5\u9700\u4e00\u6761\u547d\u4ee4\uff01\" \/><\/figure>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\"><strong>\u5b89\u88c5<\/strong> Zappa \u548c Flask\uff0c\u9879\u76ee\u9700\u8981\u5176\u4ed6\u5e93\u7684\u8bdd\uff0c\u53ef\u81ea\u884c\u6dfb\u52a0\u3002<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\"><\/code><\/pre>\n<pre>\u00a0<\/pre>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">nbsp;pipenv\u00a0install\u00a0zappa\u00a0flask<br \/><\/code><\/pre>\n<figure style=\"margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;\"><img decoding=\"async\" style=\"display: block; margin-right: auto; margin-left: auto;\" title=\"\u5f00\u6e90\u6846\u67b6 Zappa\uff1a\u4e0a\u7ebf Python \u5e94\u7528\u4ec5\u9700\u4e00\u6761\u547d\u4ee4\uff01\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2021\/03\/3-1615305696-1.png\" alt=\"\u5f00\u6e90\u6846\u67b6 Zappa\uff1a\u4e0a\u7ebf Python \u5e94\u7528\u4ec5\u9700\u4e00\u6761\u547d\u4ee4\uff01\" \/><\/figure>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u5728\u76ee\u5f55\u4e0b\u521b\u5efa <code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">my_app.py<\/code> \u6587\u4ef6\uff0c\u5199\u5165\u5b98\u65b9\u6837\u4f8b\uff0c\u53ef\u4ee5\u5148 <code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">pipenv run python my_app.py<\/code>\u770b\u770b\u662f\u5426\u80fd\u6b63\u5e38\u8fd0\u884c<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\"><span style=\"color: #333; font-weight: bold; line-height: 26px;\">from<\/span>\u00a0flask\u00a0<span style=\"color: #333; font-weight: bold; line-height: 26px;\">import<\/span>\u00a0Flask<br \/>app\u00a0=\u00a0Flask(__name__)<br \/><br \/><span style=\"color: #999; font-weight: bold; line-height: 26px;\">@app.route('\/')<\/span><br \/><span style=\"line-height: 26px;\"><span style=\"color: #333; font-weight: bold; line-height: 26px;\">def<\/span>\u00a0<span style=\"color: #900; font-weight: bold; line-height: 26px;\">hello<\/span><span style=\"line-height: 26px;\">()<\/span>:<\/span><br \/>\u00a0\u00a0\u00a0\u00a0<span style=\"color: #333; font-weight: bold; line-height: 26px;\">return<\/span>\u00a0<span style=\"color: #d14; line-height: 26px;\">\"hello,\u00a0from\u00a0Zappa!n\"<\/span><br \/><br \/><span style=\"color: #333; font-weight: bold; line-height: 26px;\">if<\/span>\u00a0__name__\u00a0==\u00a0<span style=\"color: #d14; line-height: 26px;\">'__main__'<\/span>:<br \/>\u00a0\u00a0\u00a0\u00a0app.run()<br \/><\/code><\/pre>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u6ce8\u518c AWS \u8d26\u6237\uff0c\u5e76\u4e14\u6b63\u786e\u5b89\u88c5 AWS credentials file<\/p>\n<\/section>\n<ul class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px; color: black; list-style-type: disc;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u767b\u5f55 AWS\uff0c\u627e\u5230 <code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">My Security Credentials<\/code> \u4e0b\u7684 <code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">Access keys (access key ID and secret access key)<\/code> \uff0c\u5982\u679c\u6ca1\u6709\u5219\u521b\u5efa\u4e00\u4e2a\uff0c\u8bb0\u4f4f <code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">access key ID<\/code> \u548c <code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">secret access key<\/code><\/p>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u5b89\u88c5 AWS \u7684\u547d\u4ee4\u884c\u754c\u9762\uff0c\u6dfb\u52a0 credentials<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\"><span style=\"color: #998; font-style: italic; line-height: 26px;\">#\u00a0\u5728\u865a\u62df\u73af\u5883\u4e0b\u5b89\u88c5<\/span><br \/>pipenv\u00a0install\u00a0awscli<br \/><br \/><span style=\"color: #998; font-style: italic; line-height: 26px;\">#\u00a0\u67e5\u770b\u4fe1\u606f<\/span><br \/>aws\u00a0configure\u00a0list<br \/><br \/><span style=\"color: #998; font-style: italic; line-height: 26px;\">#\u00a0\u6dfb\u52a0\uff0c\u5e76\u4e14\u6309\u7167\u63d0\u793a\u5c06\u00a0access\u00a0key\u00a0ID\u00a0\u548c\u00a0secret\u00a0access\u00a0key\u00a0\u586b\u5165<\/span><br \/>aws\u00a0configure<br \/><br \/><span style=\"color: #998; font-style: italic; line-height: 26px;\">#\u00a0\u540e\u4e24\u4e2a\u00a0region\u00a0name\u00a0\u548c\u00a0output\u00a0format\u00a0\u9009\u586b<\/span><br \/><\/code><\/pre>\n<figure style=\"margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;\"><img decoding=\"async\" style=\"display: block; margin-right: auto; margin-left: auto;\" title=\"\u5f00\u6e90\u6846\u67b6 Zappa\uff1a\u4e0a\u7ebf Python \u5e94\u7528\u4ec5\u9700\u4e00\u6761\u547d\u4ee4\uff01\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2021\/03\/9-1615305696.png\" alt=\"\u5f00\u6e90\u6846\u67b6 Zappa\uff1a\u4e0a\u7ebf Python \u5e94\u7528\u4ec5\u9700\u4e00\u6761\u547d\u4ee4\uff01\" \/><\/figure>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u6b64\u65f6\u5728 <code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">~\/.aws<\/code> \u76ee\u5f55\u4e0b\u4f1a\u51fa\u73b0\u4e24\u4e2a\u6587\u4ef6 config \u548c credentials\uff0ccredentials \u4e2d\u50a8\u5b58\u4e86 AWS \u7684 <code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">access key ID<\/code> \u548c <code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">secret access key<\/code>\uff0c config \u4e2d\u50a8\u5b58\u4e86 region name \u548c \u00a0output format \u4fe1\u606f\u3002<\/p>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u5982\u679c\u662f\u5728 Windows \u4e0a\u64cd\u4f5c\u7684\u540c\u5b66\uff0c\u53ef\u4ee5\u67e5\u770b\u5b98\u65b9\u63d0\u4f9b\u7684\u5b89\u88c5 AWS credentials file \u7684\u6559\u7a0b\u3002<\/p>\n<\/section>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 20px;\">2.3 \u5b89\u88c5\u4e0e\u914d\u7f6e<\/h3>\n<ol class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u901a\u8fc7\u6267\u884c\u4e0b\u9762\u8bed\u53e5\u8fdb\u884c\u521d\u59cb\u5316\uff0c\u5b9a\u4e49\u90e8\u7f72\u548c\u914d\u7f6e\u7684\u8bbe\u7f6e\uff0c\u81ea\u52a8\u68c0\u6d4b\u5e94\u7528\u7c7b\u578b\uff08Flask \u6216 Django\uff09<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\"><\/code><\/pre>\n<pre>\u00a0<\/pre>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">nbsp;zappa\u00a0init<br \/><\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u5728\u6267\u884c\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u80fd\u9700\u8981\u5982\u4e0b\u8bbe\u7f6e\uff0c\u540e\u7eed\u4e5f\u53ef\u4ee5\u5728\u65b0\u751f\u6210\u7684 <code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">zappa_setting.json<\/code> \u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u4fee\u6539\uff1a<\/p>\n<figure style=\"margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;\"><img decoding=\"async\" style=\"display: block; margin-right: auto; margin-left: auto;\" title=\"\u5f00\u6e90\u6846\u67b6 Zappa\uff1a\u4e0a\u7ebf Python \u5e94\u7528\u4ec5\u9700\u4e00\u6761\u547d\u4ee4\uff01\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2021\/03\/6-1615305696-1.png\" alt=\"\u5f00\u6e90\u6846\u67b6 Zappa\uff1a\u4e0a\u7ebf Python \u5e94\u7528\u4ec5\u9700\u4e00\u6761\u547d\u4ee4\uff01\" \/><\/figure>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u7684\u9879\u76ee\u76ee\u5f55\u4e2d\u5c06\u6709\u4e00\u4e2a <code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">zappa_settings.json<\/code> \u6587\u4ef6\uff0c\u91cc\u9762\u662f\u6211\u4eec\u521a\u521a\u5b9a\u4e49\u7684\u57fa\u672c\u90e8\u7f72\u8bbe\u7f6e\uff0c\u540e\u671f\u6211\u4eec\u53ef\u4ee5\u6309\u7167\u81ea\u5df1\u7684\u9700\u6c42\u4fee\u6539\u6b64\u6587\u4ef6\u3002<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">{<br \/>\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">\"dev\"<\/span>:\u00a0{<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">\"app_function\"<\/span>:\u00a0<span style=\"color: #d14; line-height: 26px;\">\"my_app.app\"<\/span>,<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">\"profile_name\"<\/span>:\u00a0<span style=\"color: #008080; line-height: 26px;\">null<\/span>,<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">\"project_name\"<\/span>:\u00a0<span style=\"color: #d14; line-height: 26px;\">\"demo\"<\/span>,<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">\"runtime\"<\/span>:\u00a0<span style=\"color: #d14; line-height: 26px;\">\"python3.6\"<\/span>,<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">\"s3_bucket\"<\/span>:\u00a0<span style=\"color: #d14; line-height: 26px;\">\"zappa-ti0ra29xi\"<\/span><br \/>\u00a0\u00a0\u00a0\u00a0}<br \/>}<br \/><\/code><\/pre>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u6ce8\u610f\u5982\u679c\u4e4b\u524d\u5df2\u7ecf\u5728 <code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">~\/.aws\/config<\/code> \u6587\u4ef6\u4e2d\u6dfb\u52a0 region \u4fe1\u606f\uff0c\u5219\u4f1a\u5728 <code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">zappa init<\/code> \u7684\u65f6\u5019\u81ea\u52a8\u5bfb\u627e\u5230\u8fd9\u4e9b region \u4fe1\u606f\uff0c\u65e0\u9700\u540e\u7eed\u4fee\u6539\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u5982\u679c\u4e4b\u524d\u6ca1\u6709\u6dfb\u52a0\uff0c\u5219\u4fee\u6539 <code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">zappa_settings.json<\/code>\uff0c\u6dfb\u52a0 region \u4fe1\u606f\u5982\u4e0b\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\"><span style=\"color: #998; font-style: italic; line-height: 26px;\">#\u00a0\u4fee\u6539\u5982\u4e0b<\/span><br \/>{<br \/>\u00a0\u00a0\u00a0\u00a0<span style=\"color: #d14; line-height: 26px;\">\"dev\"<\/span>:\u00a0{<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #d14; line-height: 26px;\">\"app_function\"<\/span>:\u00a0<span style=\"color: #d14; line-height: 26px;\">\"my_app.app\"<\/span>,<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #d14; line-height: 26px;\">\"profile_name\"<\/span>:\u00a0null,<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #d14; line-height: 26px;\">\"project_name\"<\/span>:\u00a0<span style=\"color: #d14; line-height: 26px;\">\"demo\"<\/span>,<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #d14; line-height: 26px;\">\"runtime\"<\/span>:\u00a0<span style=\"color: #d14; line-height: 26px;\">\"python3.6\"<\/span>,<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #d14; line-height: 26px;\">\"s3_bucket\"<\/span>:\u00a0<span style=\"color: #d14; line-height: 26px;\">\"zappa-ti0ra29xi\"<\/span><br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #d14; line-height: 26px;\">\"aws_region\"<\/span>:\u00a0<span style=\"color: #d14; line-height: 26px;\">\"us-west-2\"<\/span><br \/>\u00a0\u00a0\u00a0\u00a0}<br \/>}<br \/><\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">region \u7684\u4fe1\u606f\u53ef\u4ee5\u81ea\u884c\u9009\u62e9\u3002<\/p>\n<\/section>\n<\/li>\n<\/ol>\n<h3 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; font-size: 20px;\">2.4 \u90e8\u7f72\u548c\u4f7f\u7528<\/h3>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u914d\u7f6e\u8bbe\u7f6e\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\u5c06\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u5e76\u90e8\u7f72\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; padding: 16px; color: #333; background: #f8f8f8; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; border-radius: 0px; font-size: 12px; -webkit-overflow-scrolling: touch;\"><\/code><\/pre>\n<pre>\u00a0<\/pre>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; padding: 16px; color: #333; background: #f8f8f8; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; border-radius: 0px; font-size: 12px; -webkit-overflow-scrolling: touch;\">nbsp;zappa\u00a0deploy\u00a0dev<br \/><\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u5f53\u6211\u4eec\u8c03\u7528 deploy \u65f6\uff0cZappa \u4f1a\u81ea\u52a8\u5c06\u6211\u4eec\u7684\u5e94\u7528\u7a0b\u5e8f\u548c\u672c\u5730\u865a\u62df\u73af\u5883\u6253\u5305\u5230 Lambda \u517c\u5bb9\u7684 archive\uff0c\u7528\u4e3a Lambda \u9884\u5148\u7f16\u8bd1\u7684\u7248\u672c\u66ff\u6362\u6240\u6709\u4f9d\u8d56\u9879\uff0c\u8bbe\u7f6e\u529f\u80fd\u5904\u7406\u7a0b\u5e8f\u548c\u5fc5\u8981\u7684 WSGI \u4e2d\u95f4\u4ef6\uff0c\u7136\u540e\u4e0a\u4f20 archive \u5230 S3\uff0c\u521b\u5efa\u548c\u7ba1\u7406\u5fc5\u8981\u7684Amazon IAM \u7b56\u7565\u548c\u89d2\u8272\uff0c\u5c06\u5176\u6ce8\u518c\u4e3a\u65b0\u7684 Lambda function\uff0c\u521b\u5efa\u65b0\u7684 API \u7f51\u5173\u8d44\u6e90\uff0c\u4e3a\u5176\u521b\u5efa WSGI \u517c\u5bb9\u7684\u8def\u7531\uff0c\u5c06\u5176\u94fe\u63a5\u5230\u65b0\u7684 Lambda function\uff0c\u6700\u540e\u4ece S3 bucket \u4e2d\u5220\u9664 archive\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u6267\u884c\u6210\u529f\u540e\uff0c\u5c31\u4f1a\u51fa\u73b0\u4e00\u4e2a\u94fe\u63a5\uff0c\u70b9\u51fb\u94fe\u63a5\u5373\u53ef\u8bbf\u95ee\u6211\u4eec\u7684\u7b80\u6613 Web \u5e94\u7528\u3002\u770b\u5230\u5df2\u4e0a\u7ebf\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u5fc3\u5185\u7a83\u559c\uff0c\u76f4\u547c\u5feb\u51c6\u72e0\u3002<\/p>\n<figure style=\"margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;\"><img decoding=\"async\" style=\"display: block; margin-right: auto; margin-left: auto;\" title=\"\u5f00\u6e90\u6846\u67b6 Zappa\uff1a\u4e0a\u7ebf Python \u5e94\u7528\u4ec5\u9700\u4e00\u6761\u547d\u4ee4\uff01\" src=\"http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2021\/03\/6-1615305696-2.png\" alt=\"\u5f00\u6e90\u6846\u67b6 Zappa\uff1a\u4e0a\u7ebf Python \u5e94\u7528\u4ec5\u9700\u4e00\u6761\u547d\u4ee4\uff01\" \/><\/figure>\n<h2 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; border-bottom: 2px solid #ef7060; font-size: 1.3em;\"><span style=\"display: inline-block; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e09\u3001\u5176\u4ed6\u547d\u4ee4<\/span><\/h2>\n<ol class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u66f4\u65b0\u64cd\u4f5c\uff1a\u5047\u8bbe\u5e94\u7528\u7a0b\u5e8f\u5df2\u7ecf\u90e8\u7f72\u5b8c\u6bd5\uff0c\u5e76\u4e14\u53ea\u9700\u8981\u4e0a\u4f20\u65b0\u7684 Python \u4ee3\u7801\uff0c\u800c\u65e0\u9700\u4fee\u6539\u57fa\u7840\u8def\u7531\uff0c\u5219\u53ef\u4ee5\u6267\u884c\u4ee5\u4e0b\u64cd\u4f5c\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\"><\/code><\/pre>\n<pre>\u00a0<\/pre>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">nbsp;zappa\u00a0update\u00a0dev<br \/><\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u8fd9\u5c06\u521b\u5efa\u4e00\u4e2a\u65b0\u7684 archive\uff0c\u5c06\u5176\u4e0a\u4f20\u5230 S3 \u5e76\u66f4\u65b0 Lambda function \u4ee5\u4f7f\u7528\u65b0\u4ee3\u7801\u3002<\/p>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u67e5\u770b\u90e8\u7f72\u548c\u4e8b\u4ef6\u8ba1\u5212\u7684\u72b6\u6001\uff0c\u53ea\u9700\u4f7f\u7528\u547d\u4ee4\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\"><\/code><\/pre>\n<pre>\u00a0<\/pre>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">nbsp;zappa\u00a0status\u00a0production<br \/><\/code><\/pre>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u67e5\u770b\u90e8\u7f72\u7684\u65e5\u5fd7\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\"><\/code><\/pre>\n<pre>\u00a0<\/pre>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">nbsp;zappa\u00a0tail\u00a0dev<br \/><br \/><span style=\"color: #998; font-style: italic; line-height: 26px;\">#\u00a0\u8fc7\u6ee4\u00a0HTTP\u00a0\u8bf7\u6c42<\/span><br \/><\/code><\/pre>\n<pre>\u00a0<\/pre>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">nbsp;zappa\u00a0tail\u00a0dev\u00a0--http<br \/><br \/><span style=\"color: #998; font-style: italic; line-height: 26px;\">#\u00a0\u6267\u884c\u76f8\u53cd\u64cd\u4f5c\uff0c\u5e76\u4e14\u4ec5\u663e\u793a\u975e\u00a0HTTP\u00a0\u4e8b\u4ef6\u548c\u65e5\u5fd7\u6d88\u606f<\/span><br \/><\/code><\/pre>\n<pre>\u00a0<\/pre>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">nbsp;zappa\u00a0tail\u00a0dev\u00a0--non-http<br \/><br \/><span style=\"color: #998; font-style: italic; line-height: 26px;\">#\u00a0\u9009\u62e9\u65f6\u957f<\/span><br \/><\/code><\/pre>\n<pre>\u00a0<\/pre>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">nbsp;zappa\u00a0tail\u00a0dev\u00a0--since\u00a04h\u00a0<span style=\"color: #998; font-style: italic; line-height: 26px;\">#\u00a04\u00a0hours<\/span><br \/><\/code><\/pre>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u56de\u6eda\u64cd\u4f5c\uff1a\u901a\u8fc7\u63d0\u4f9b\u8981\u8fd4\u56de\u7684\u4fee\u8ba2\u7248\u672c\u6570\u5c06\u90e8\u7f72\u7684\u4ee3\u7801\u56de\u6eda\u5230\u4ee5\u524d\u7684\u7248\u672c\u3002<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\"><span style=\"color: #998; font-style: italic; line-height: 26px;\">#\u00a0\u56de\u6eda\u52303\u5e74\u524d\u90e8\u7f72\u7684\u7248\u672c<\/span><br \/><\/code><\/pre>\n<pre>\u00a0<\/pre>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">nbsp;zappa\u00a0rollback\u00a0production\u00a0-n\u00a03<br \/><\/code><\/pre>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u5b89\u6392 function \u5b9a\u671f\u6267\u884c\uff1a\u4fee\u6539 <code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">zappa_setting.json<\/code> \uff0c\u52a0\u5165\u5982\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">{<br \/>\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">\"dev\"<\/span>:\u00a0{<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0...<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">\"events\"<\/span>:\u00a0[{<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #998; font-style: italic; line-height: 26px;\">\/\/\u00a0The\u00a0function\u00a0to\u00a0execute<\/span><br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">\"function\"<\/span>:\u00a0<span style=\"color: #d14; line-height: 26px;\">\"your_module.your_function\"<\/span>,<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #998; font-style: italic; line-height: 26px;\">\/\/\u00a0When\u00a0to\u00a0execute\u00a0it\u00a0(in\u00a0cron\u00a0or\u00a0rate\u00a0format)<\/span><br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"line-height: 26px;\">\"expression\"<\/span>:\u00a0<span style=\"color: #d14; line-height: 26px;\">\"rate(1\u00a0minute)\"<\/span>\u00a0<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}],<br \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0...<br \/>\u00a0\u00a0\u00a0\u00a0}<br \/>}<br \/><\/code><\/pre>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u7136\u540e\u6267\u884c\u5982\u4e0b\u64cd\u4f5c\uff0c\u6211\u4eec\u7684 function \u5c31\u4f1a\u5728\u6bcf\u5206\u949f\u6267\u884c\u4e00\u6b21\u3002<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\"><\/code><\/pre>\n<pre>\u00a0<\/pre>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">nbsp;zappa\u00a0schedule\u00a0dev<br \/><br \/><span style=\"color: #998; font-style: italic; line-height: 26px;\">#\u00a0cancal<\/span><br \/><\/code><\/pre>\n<pre>\u00a0<\/pre>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">nbsp;zappa\u00a0unschedule\u00a0dev<br \/><\/code><\/pre>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u53d6\u6d88\u90e8\u7f72\uff1a\u5982\u679c\u8981\u5220\u9664\u4ee5\u524d\u53d1\u5e03\u7684 API Gateway \u548c Lambda function\uff0c\u5219\u53ea\u9700\uff1a<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\"><\/code><\/pre>\n<pre>\u00a0<\/pre>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">nbsp;zappa\u00a0unschedule\u00a0dev<br \/><\/code><\/pre>\n<\/section>\n<\/li>\n<\/ol>\n<h2 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; border-bottom: 2px solid #ef7060; font-size: 1.3em;\"><span style=\"display: inline-block; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u56db\u3001\u8e29\u5751\u5efa\u8bae<\/span><\/h2>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u5728\u6210\u529f\u8fd0\u884c\u4e00\u6b21\u4e4b\u524d\uff0c\u8e29\u5751\u5343\u5343\u4e07\u4e07\u904d\uff0c\u90fd\u662f\u56e0\u4e3a\u81ea\u5df1\u624b\u6b8b\u773c\u778e\u9b54\u6539\u4e86\u5f88\u591a\u5730\u65b9\uff0c\u628a\u7ecf\u5386\u8fc7\u7684\u62a5\u9519\u8bb0\u5f55\u4e0b\u6765\uff0c\u5206\u4eab\u7ed9\u548c\u6211\u4e00\u6837\u7684\u5c0f\u5c0f\u767d\u3002<\/p>\n<ol class=\"list-paddingleft-2\" style=\"margin-top: 8px; margin-bottom: 8px; padding-left: 25px;\">\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\"><code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">\u201cUnable to import module \u2018handler\u2019: attempted relative import with no known parent package\u201d<\/code>\uff1a\u539f\u56e0\u662f\u6211\u4eec\u671f\u671b\u7684\u4f9d\u8d56\u5728\u865a\u62df\u7684\u73af\u5883\u4e2d\u6ca1\u6709\uff0c\u9700\u8981\u67e5\u770b\u81ea\u5df1\u865a\u62df\u73af\u5883\u4e2d\u7684\u4f9d\u8d56\u662f\u5426\u5b8c\u6574\u3002<\/p>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u51fa\u73b0\u5982\u4e0b\u62a5\u9519\uff0c\u53ef\u4ee5\u66f4\u6362\u4e00\u4e2a region \u4fe1\u606f\u3002<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\"><\/code><\/pre>\n<pre>\u00a0<\/pre>\n<pre style=\"margin-top: 10px; margin-bottom: 10px;\"><code style=\"overflow-x: auto; background: rgba(27, 31, 35, 0.05); display: -webkit-box; font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">nbsp;zappa\u00a0deploy\u00a0dev<br \/>Calling\u00a0deploy\u00a0<span style=\"color: #333; font-weight: bold; line-height: 26px;\">for<\/span>\u00a0stage\u00a0dev..<br \/>Creating\u00a0demo-dev-ZappaLambdaExecutionRole\u00a0IAM\u00a0Role..<br \/>Error:\u00a0Failed\u00a0to\u00a0manage\u00a0IAM\u00a0roles!<br \/>You\u00a0may\u00a0lack\u00a0the\u00a0necessary\u00a0AWS\u00a0permissions\u00a0to\u00a0automatically\u00a0manage\u00a0a\u00a0Zappa\u00a0execution\u00a0role.<br \/>Exception\u00a0reported\u00a0by\u00a0AWS:An\u00a0error\u00a0occurred\u00a0(InvalidClientTokenId)\u00a0when\u00a0calling\u00a0the\u00a0CreateRole\u00a0operation:\u00a0The\u00a0security\u00a0token\u00a0included\u00a0<span style=\"color: #333; font-weight: bold; line-height: 26px;\">in<\/span>\u00a0the\u00a0request\u00a0is\u00a0invalid.<br \/>To\u00a0fix\u00a0this,\u00a0see\u00a0here:\u00a0https:\/\/github.com\/Miserlou\/Zappa<span style=\"color: #998; font-style: italic; line-height: 26px;\">#custom-aws-iam-roles-and-policies-for-deployment<\/span><br \/><\/code><\/pre>\n<\/section>\n<\/li>\n<li>\n<section style=\"margin-top: 5px; margin-bottom: 5px; line-height: 26px; color: #010101;\">\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black;\">\u5982\u679c\u6211\u4eec\u5728 <code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">zappa init<\/code> \u7684\u65f6\u5019\uff0c\u4e0d\u4f7f\u7528\u9ed8\u8ba4\u5206\u914d\u7684 <code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">s3_bucket<\/code> \uff0c\u5219\u987b\u6ce8\u610f\u81ea\u5df1\u7684\u540d\u79f0\u662f\u4e0d\u5141\u8bb8\u91cd\u540d\u7684\uff0c\u5426\u5219\u4f1a\u62a5\u9519 <code style=\"font-size: 14px; padding: 2px 4px; border-radius: 4px; margin-right: 2px; margin-left: 2px; background-color: rgba(27, 31, 35, 0.05); font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #ef7060;\">botocore.errorfactory.BucketAlreadyExists: An error occurred (BucketAlreadyExists) when calling the CreateBucket operation: The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again.<\/code> \u3002<\/p>\n<\/section>\n<\/li>\n<\/ol>\n<h2 style=\"margin-top: 30px; margin-bottom: 15px; font-weight: bold; border-bottom: 2px solid #ef7060; font-size: 1.3em;\"><span style=\"display: inline-block; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e94\u3001\u5199\u5728\u6700\u540e<\/span><\/h2>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u662f\u4e0d\u662f\u5f53\u81ea\u5df1\u6210\u529f\u90e8\u7f72\u540e\uff0c\u7a81\u7136\u89c9\u5f97\u5999\u4e0d\u53ef\u8a00\uff0c\u4e00\u8eab\u8f7b\u677e\uff0c\u597d\u50cf\u518d\u4e5f\u6ca1\u6709\u4e86\u4e4b\u524d\u6240\u8bf4\u7684\u7e41\u7410\u7684\u8fc7\u7a0b\uff0c\u53cd\u800c\u51e0\u6761\u547d\u4ee4\uff0c\u767dpiao AWS \u7684\u670d\u52a1\uff0c\u54b1\u7684\u5e94\u7528\u7a0b\u5e8f\u5c31\u8f7b\u5de7\u4e0a\u7ebf\u4e86\u5462\uff0c\u8fd8\u4e0d\u8d76\u7d27\u628a\u751f\u6210\u7684\u94fe\u63a5\u5206\u4eab\u7ed9\u5c0f\u4f19\u4f34\u4eec\u70b9\u51fb\u4e00\u4e0b\u3002<\/p>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px;\">\u81f3\u6b64\uff0c\u6211\u4eec\u5df2\u7ecf\u53ef\u4ee5\u57fa\u672c\u5b9e\u73b0\u5feb\u901f\u90e8\u7f72\u4e00\u4e2a\u7b80\u5355\u7684 Flask \u5e94\u7528\u4e86\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u8fd8\u6709\u90e8\u5206 Zappa \u7684\u9ad8\u7ea7\u529f\u80fd\u6ca1\u6709\u63d0\u53ca\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528 Zappa \u90e8\u7f72 Django \u5e94\u7528\u6216\u8005\u4e00\u4e2a\u66f4\u4e3a\u5e9e\u5927\u7684\u9879\u76ee\uff08\u5305\u542b\u6570\u636e\u5e93\u7b49\uff09\uff0c\u5e0c\u671b\u611f\u5174\u8da3\u7684\u5c0f\u4f19\u4f34\u4eec\u80fd\u591f\u591a\u591a\u5c1d\u8bd5\uff0c\u6211\u5df2\u7ecf\u5f00\u59cb\u671f\u5f85\u5f97\u6413\u6413\u624b\u4e86<\/p>\n<\/div>\n\n\n<p>\u8f6c\u81ea\uff1ahttps:\/\/mp.weixin.qq.com\/s\/Yfg163FzIY4kZpeTKoU05w<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f5c\u8005\uff1aHelloGitHub-\u5431\u5431 \u8fd9\u91cc\u662f HelloGitHub \u63a8\u51fa\u7684\u300a\u8bb2\u89e3\u5f00\u6e90\u9879\u76ee\u300b\u7cfb\u5217\uff0c\u4eca\u5929\u8981\u5411\u5c0f\u4f19\u4f34 &hellip; <a href=\"http:\/\/www.zhushiyao.com\/?p=57664\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201c\u5f00\u6e90\u6846\u67b6 Zappa\uff1a\u4e0a\u7ebf Python \u5e94\u7528\u4ec5\u9700\u4e00\u6761\u547d\u4ee4\uff01\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[8],"_links":{"self":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/57664"}],"collection":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=57664"}],"version-history":[{"count":2,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/57664\/revisions"}],"predecessor-version":[{"id":57677,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/57664\/revisions\/57677"}],"wp:attachment":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=57664"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=57664"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=57664"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}