{"id":316515,"date":"2021-02-04T19:41:02","date_gmt":"2021-02-04T11:41:02","guid":{"rendered":"http:\/\/4563.org\/?p=316515"},"modified":"2021-02-04T19:41:02","modified_gmt":"2021-02-04T11:41:02","slug":"python-flask-%e5%ae%9e%e7%8e%b0-http-%e6%b6%88%e6%81%af%e4%bb%a3%e7%90%86%e6%9c%8d%e5%8a%a1%ef%bc%8c%e6%80%8e%e4%b9%88%e9%85%8d%e7%bd%ae%e9%ab%98%e5%b9%b6%e5%8f%91%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=316515","title":{"rendered":"Python flask \u5b9e\u73b0 http \u6d88\u606f\u4ee3\u7406\u670d\u52a1\uff0c\u600e\u4e48\u914d\u7f6e\u9ad8\u5e76\u53d1\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Python flask \u5b9e\u73b0 http \u6d88\u606f\u4ee3\u7406\u670d\u52a1\uff0c\u600e\u4e48\u914d\u7f6e\u9ad8\u5e76\u53d1\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : PPTX <\/span>  <span><i><\/i> 5<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>flask \u5b9e\u73b0\u4e00\u4e2a http \u6d88\u606f\u4ee3\u7406\u670d\u52a1\uff0c\u5373 \u5ba2\u6237\u7aef A -&gt; \u4ee3\u7406 -&gt; \u670d\u52a1\u5668 B \u3002 \u76ee\u524d\u65b9\u6848\uff1a<\/p>\n<ol>\n<li>\u4ee3\u7406 \u6536\u5230 A \u7684\u8bf7\u6c42\u6d88\u606f\u3002<\/li>\n<li>\u4ee3\u7406 \u5c06\u8bf7\u6c42\u6d88\u606f\u7a0d\u5fae\u5904\u7406\uff0c\u7136\u540e\u628a\u8bf7\u6c42\u53d1\u9001\u7ed9 B \u3002<\/li>\n<li>\u4ee3\u7406 \u6536\u5230 B \u7684\u56de\u590d\u6d88\u606f\u3002<\/li>\n<li>\u4ee3\u7406 \u5c06\u56de\u590d\u6d88\u606f\u7a0d\u5fae\u5904\u7406\uff0c\u53d1\u7ed9 A \u56de\u590d\u3002<\/li>\n<\/ol>\n<p>\u8bf7\u6c42\u7528\u7684 requests<\/p>\n<p>\u76ee\u524d\u662f\u4ee3\u7406\u6536\u5230 A \u7684\u8bf7\u6c42\u540e\uff0c\u4f1a\u7b49\u5f85\u4ee3\u7406\u8bf7\u6c42 B \u5f97\u5230\u56de\u590d\u540e\uff0c\u518d\u628a\u5185\u5bb9\u56de\u590d\u7ed9 A \u3002\u4f1a\u6709\u7b49\u5f85\u3002\u6d4b\u8bd5\u53d1\u73b0\u8be5\u65b9\u5f0f\u9ad8\u5e76\u53d1\u6027\u80fd\u6bd4\u8f83\u5dee\uff0c\u9700\u8981\u54ea\u4e9b\u4f18\u5316\u5904\u7406\uff1f<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>18<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5078431\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : chroming <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e3b\u8981\u8017\u65f6\u5728\u4ee3\u7406\u7b49 B \u7684\u8fc7\u7a0b\uff1f\u7528\u4e86 gunicorn+nginx \u4e48\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5078432\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : chenqh <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6539\u7528 tornado \u5427\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5078433\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wuwukai007 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             fastapi \u6216\u8005 django3.1 \u5427                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5078434\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : viiii <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6709\u9ad8\u5e76\u53d1\u9700\u6c42, \u76f4\u63a5\u65e0\u8111 fastapi                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5078435\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : BeanYoung <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u573a\u666f\u9002\u5408\u7528 openresty\uff0c\u6ca1\u6709\u6bd4\u8fd9\u4e2a\u6027\u80fd\u66f4\u597d\u7684\u4e86\u5e94\u8be5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5078436\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : plko345 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @BeanYoung \u8fd9\u4e0d\u662f nginx \u5417\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5078437\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : itdog888 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @BeanYoung \u8fd9\u4e2a\u548c nginx \u6709\u4ec0\u4e48\u5206\u522b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5078438\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : leir <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @plko345 @itdog888 \u4e3b\u7684\u9700\u6c42\u7528 nginx+Lua \u5199\u8f6c\u53d1\u89c4\u5219\uff0c\u6539\u534f\u8bae\u5b57\u6bb5\uff0c\u6027\u80fd\u6700\u597d\uff0c\u5de5\u4f5c\u91cf\u6700\u5c0f<br \/>nginx wiki \u4e2d\u63a8\u8350\u4f7f\u7528 openresty <\/p>\n<p>HTTP Lua Embed the power of Lua into NGINX HTTP servers (OpenResty Official)                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5078439\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : PPTX <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @plko345 \u56e0\u4e3a\u5bf9\u6570\u636e\u8fd8\u6709\u4e00\u5b9a\u7684\u5904\u7406\uff0c\u6240\u4ee5\u4e0d\u80fd\u76f4\u63a5\u7528 nginx\uff0c\u76ee\u524d\u7528\u4e86 nginx \u53cd\u5411\u4ee3\u7406\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5078440\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Vegetable <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             fastapi+httpx\uff0c\u91c7\u7528\u534f\u7a0b\u65b9\u6848\uff0c\u5bf9\u4ee3\u7801\u6539\u52a8\u6700\u5c0f\u3002\u957f\u5f97\u548c flask+requests \u5dee\u4e0d\u591a\uff0c\u6027\u80fd\u57fa\u672c\u5c31\u662f python \u5929\u82b1\u677f\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5078441\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : LeeReamond <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             py \u7684\u9ad8\u5e76\u53d1\u7684\u8bdd\u80af\u5b9a\u662f\u8981\u4e0a io \u590d\u7528\u7684\uff0cflask \u600e\u4e48\u90e8\u7f72\u90fd\u4e0d\u884c\u3002fastapi \u6211\u6ca1\u6d4b\u8bd5\u8fc7\uff0caiohttp \u7684\u8bdd\u53ef\u4ee5\u4e0a uvloop+prefork \u90e8\u7f72\uff0c\u5355\u673a\u53ef\u7528\u6027\u80fd\u8fbe\u5230\u51e0\u4e07 qps\uff0c\u5f88\u53ef\u4ee5\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5078442\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : laminux29 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             Python \u7684\u4f18\u52bf\u5728\u4e8e\u8d85\u9ad8\u7684\u5f00\u53d1\u6548\u7387\uff0c\u5982\u679c\u4e00\u5b9a\u8981\u8ffd\u6c42\u8fd0\u884c\u6027\u80fd\uff0c\u5efa\u8bae\u8003\u8651\u4e00\u4e0b C++\uff0c\u6216\u8005\u628a Python \u8017\u6027\u80fd\u7684\u90e8\u5206\u6539\u6210 C++\u5b9e\u73b0\u6216 C++\u4e2d\u95f4\u4ef6\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5078443\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : abersheeran <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             flask \u3001requests \u8fd9\u4e24\u4e2a\u5e93\uff0c\u8ddf\u9ad8\u5e76\u53d1\u8fd9\u4e2a\u8bcd\u4e00\u70b9\u5173\u7cfb\u90fd\u6ca1\u6709\u2026\u2026<\/p>\n<p>\u4f60\u8fd9\u4e2a\u9700\u6c42\u4e5f\u522b\u7528 fastapi\uff0c\u4ed6\u90a3\u4e2a\u4f9d\u8d56\u6ce8\u5165\u4e00\u4e0a\uff0c\u6027\u80fd\u54d7\u5566\u5566\u5f80\u4e0b\u6ed1\u3002\u5012\u4e0d\u662f\u8bf4\u4f9d\u8d56\u6ce8\u5165\u4e0d\u597d\u7528\uff0c\u5173\u952e\u4f60\u8fd9\u4e2a\u9700\u6c42\u7528\u4e0d\u4e0a\u3002 @Vegetable \u5929\u82b1\u677f\u5c31\u7701\u7701\u5427\u2026\u2026\u5b83\u662f\u5929\u82b1\u677f\uff0c\u90a3\u6211\u5199\u4e2a\u73a9\u610f\uff0c\u6027\u80fd\u662f\u5b83 1.5 \u500d\uff0c\u5c82\u4e0d\u662f\u628a\u70b8\u4e86\uff1f<\/p>\n<p>\u4e0a\u8bf4\u7684\u5bf9\uff0c\u5982\u679c\u4f60\u4f1a\u7528 openresty\uff0c\u8fd9\u4e2a\u662f\u6700\u597d\u7684\u3002\u5982\u679c\u6267\u610f\u7528 Python\uff0c\u63a8\u8350 bottle\/pyramid \u3002\u771f\u6b63\u7684 Python web \u6846\u67b6\u6027\u80fd\u5929\u82b1\u677f\u3002https:\/\/github.com\/the-benchmarker\/web-frameworks \u4ee5\u9632\u6709\u4eba\u8bf4\u6211\u4fe1\u53e3\u5f00\u6cb3\uff0c\u6027\u80fd\u6d4b\u8bd5\u6392\u540d\u5728\u6b64\u3002<\/p>\n<p>\u7136\u540e\u8bf7\u6c42\u90e8\u5206\uff0c\u5982\u679c\u4f60\u4e0a\u4e86\u6211\u8bf4\u7684\u4e24\u4e2a\u6846\u67b6\u4e4b\u4e00\uff0crequests\/httpx \u968f\u4fbf\u6311\u4e00\u4e2a\u5c31\u597d\u4e86\u3002\u6709\u6808\u534f\u7a0b\u4e00\u5f00\uff0c\u90fd\u53ef\u4ee5\u7684\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5078444\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : sadfQED2 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @PPTX openresty \u662f\u6700\u597d\u7684\u9009\u62e9\u4e86\uff0c\u6570\u636e\u5904\u7406\u4ec0\u4e48\u7684\u4e0d\u662f\u95ee\u9898\uff0copenresty+lua \u4f60\u67e5\u5e93\u5199\u4e1a\u52a1\u903b\u8f91\u90fd\u6ca1\u95ee\u9898                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5078445\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : PPTX <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @abersheeran <br \/>@sadfQED2 <br \/>\u76ee\u524d\u7684\u4ee3\u7406\u6d88\u606f\u8d70\u5411\uff1a\u5ba2\u6237\u7aef A &#8211;&gt; \u6211\u7684\u4ee3\u7406 &#8211;&gt; \u670d\u52a1\u7aef B \u3002 <br \/>\u6211\u7684\u4ee3\u7406\u6536\u5230 A \u7684\u8bf7\u6c42\u540e\uff0c\u4f1a\u7b49\u5f85\u8bf7\u6c42 B \u5f97\u5230\u56de\u590d\u540e\uff0c\u518d\u628a\u5185\u5bb9\u56de\u590d\u7ed9 A \u3002<\/p>\n<p>\u6211\u7684\u4ee3\u7406 \u5728\u6536\u5230 \u5ba2\u6237\u7aef A \u7684\u8bf7\u6c42\u540e\uff0c\u4f1a\u8bbf\u95ee redis\uff0c\u627e\u51fa\u8bf7\u6c42 url \u5230\u670d\u52a1\u7aef url \u7684\u6620\u5c04\uff0c\u4e5f\u5c31\u662f\u6bcf\u6761\u8bf7\u6c42\u6d88\u606f\uff0c\u670d\u52a1\u7aef\u7684 url \u53ef\u80fd\u90fd\u662f\u4e0d\u540c\u7684\uff0c\u5b58\u5728 redis \u91cc\u3002\u8fd9\u4e2a\u573a\u666f\uff0c\u7528 openresty + lua \u80fd\u5b9e\u73b0\u5417\uff1f \u611f\u8c22                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5078446\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : abersheeran <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @PPTX \u53ef\u4ee5\u3002Lua \u64cd\u4f5c redis \u5457\uff0c\u6709\u73b0\u6210\u7684\u5e93\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5078447\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : PPTX <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @abersheeran \u591a\u8c22                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5078448\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hushao <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             tornado\/aiohttp\/starlette\/django3 + httpx \u5f02\u6b65\u8bf7\u6c42\uff0casgi \u65b9\u5f0f\u90e8\u7f72\uff0c\u5176\u4e2d httpx \u548c requests \u7684\u7528\u6cd5\u517c\u5bb9\u3002flask \u672c\u8eab\u5c31\u7b97\u4e86\uff0c\u786e\u5b9e\u8ddf\u5e76\u53d1\u4e0d\u4e00\u6761\u8def\u3002<\/p>\n<p>\u91cd\u70b9\u662f\u5f02\u6b65\u7f51\u7edc\u8bf7\u6c42\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Python flask \u5b9e\u73b0 h&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/316515"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=316515"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/316515\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=316515"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=316515"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=316515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}