{"id":191789,"date":"2020-10-26T05:02:22","date_gmt":"2020-10-25T21:02:22","guid":{"rendered":"http:\/\/4563.org\/?p=191789"},"modified":"2020-10-26T05:02:22","modified_gmt":"2020-10-25T21:02:22","slug":"wsgi-%e6%9c%89%e4%bb%80%e4%b9%88%e4%bd%9c%e7%94%a8%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=191789","title":{"rendered":"wsgi \u6709\u4ec0\u4e48\u4f5c\u7528\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  wsgi \u6709\u4ec0\u4e48\u4f5c\u7528\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : SystemLight <\/span>  <span><i><\/i> 4<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>python \u4e2d\u7684 web \u6846\u67b6\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c web \u7a0b\u5e8f\uff0c\u6d4f\u89c8\u5668\u53ef\u4ee5\u76f4\u63a5\u8bbf\u95ee\uff0c\u4f46\u662f\u4e3a\u4ec0\u4e00\u822c\u90e8\u7f72\u7684\u65f6\u5019\u8fd8\u9700\u8981 nginx+wsgi \u8fd9\u79cd\u6a21\u5f0f\u53bb\u90e8\u7f72\u5462\uff0c\u5982 flask\uff0cDjango\uff0ctornado\uff0c\u4e3a\u4ec0\u4e48\u4e0d\u662f\u76f4\u63a5\u628a\u7a0b\u5e8f\u653e\u5230\u670d\u52a1\u5668\u4e0a\u5e76\u8fd0\u884c\u5462\u3002<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>14<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4127989\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : gstqc <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u591a\u8fdb\u7a0b\uff0c\u591a\u670d\u52a1\uff0c\u8fd0\u7ef4\u65b9\u4fbf                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4127990\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : GodFastion <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7a33\u5b9a\u6027\u8981\u6bd4\u81ea\u5e26\u7684\u597d\u5f97\u591a\uff0c\u81ea\u5e26\u7684\u53ea\u9002\u5408\u5f00\u53d1\u65f6\u4f7f\u7528                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4127991\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : rebeccaMyKid <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4ee5\u524d\u601d\u8003\u8fc7\u8fd9\u4e2a\u95ee\u9898\u3002\u6211\u628a\u4ee5\u524d\u770b\u8fc7\u7684\u5185\u5bb9\u627e\u7ed9\u4f60\u3002<\/p>\n<p>\u6211\u7406\u89e3\u7684\u662f\uff1a<br \/>1. flash \u662f\u4e2a webframework\uff0c\u662f\u4e2a\u6846\u67b6\uff0c\u4e0d\u662f http \u670d\u52a1\u5668\u6216\u8005 wsgi \u670d\u52a1\u5668. \u53e6\u5916\u4e24\u4e2a\u4e0d\u77e5\u9053\uff0c\u4f30\u8ba1\u4e5f\u662f\u4e00\u6837\u7684\u3002<br \/>2. \u6846\u67b6\u53ea\u662f\u628a\u670d\u52a1\u5668\u63a5\u6536\u5230\u7684\u4e1c\u897f\u7ed9\u4f60\u6a21\u5757\u5316\u5904\u7406\u4e86\u3002\u4f60\u5199\u4e2a CGI \u5c31\u77e5\u9053\u6709\u591a\u9ebb\u70e6\u4e86\u3002<\/p>\n<p>\u6211\u6ca1\u8bb0\u9519\u7684\u8bdd\uff0c\u597d\u50cf\u591a\u662f Nginx + Gunicorn + flask \u7684\u6a21\u5f0f\uff0cGunicorn \u662f flask \u7684\u5bb9\u5668\uff0c\u662f\u4e00\u4e2a server \u3002\u770b\u8fd9\u4e2a\u95ee\u9898 https:\/\/stackoverflow.com\/questions\/20766684\/what-benefit-is-added-by-using-gunicorn-nginx-flask?noredirect=1&amp;lq=1<\/p>\n<p>\u7136\u540e\u4e3a\u4ec0\u4e48\u8fd8\u8981\u5728 Gunicorn \u8fd9\u4e2a server \u5916\u9762\u8fd8\u52a0\u4e00\u4e2a Nginx\uff0c\u770b\u8fd9\u4e2a https:\/\/serverfault.com\/questions\/220046\/why-is-setting-nginx-as-a-reverse-proxy-a-good-idea \u3002\u6211\u770b\u8fc7\u4e0d\u662f\u5f88\u61c2\u3002<\/p>\n<p>WSGI \u662f\u4e00\u79cd\u534f\u8bae\uff0c\u6bd4\u5982\uff0c\u6211\u6ca1\u8bb0\u9519\u7684\u8bdd\uff0cnginx \u548c Gunicorn \u4e4b\u95f4\u53ef\u4ee5\u7528 WSGI \u534f\u8bae\u901a\u4fe1\uff0cGunicorn \u597d\u50cf\u540c\u65f6\u652f\u6301 HTTP \u534f\u8bae\u548c WSGI \u534f\u8bae\u3002<\/p>\n<p>\u7136\u540e\u4f60\u8bf4\u7684\u201c\u4e3a\u4ec0\u4e48\u4e0d\u76f4\u63a5\u628a\u7a0b\u5e8f\u653e\u5230\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\u5462\u201d\uff1f \u770b\u8fd9\u4e2a https:\/\/docs.python.org\/3.4\/howto\/webservers.html?highlight=cgi\uff0c\u8fd9\u91cc\u8bb2\u4e86 cgi, mod_python\uff0c\u518d\u5230 fast_cgi\uff0c\u518d\u5230 wsgi \u7684\u6f14\u53d8\u3002\u5177\u4f53\u7406\u7531\u6211\u5fd8\u4e86\u3002<\/p>\n<p>\u8981\u660e\u767d\u8fd9\u4e9b\uff0c\u6211\u4f30\u8ba1\u4f60\u8fd8\u5f97\u4e86\u89e3\u4e00\u4e0b web \u670d\u52a1\u5668\u662f\u600e\u4e48\u8c03\u7528\u201d\u6846\u67b6\u201c\u7684\u3002\u6211\u5927\u6982\u6709\u4e2a\u5370\u8c61\uff0c\u4f46\u4e0d\u662f\u7279\u522b\u6e05\u695a\u3002\u6bd4\u5982\u4f60\u53ef\u4ee5\u4e86\u89e3\u4e00\u4e0b apache \u662f\u600e\u4e48\u8c03\u7528 mod_python \u7684\uff0cmod_python \u6211\u8bb0\u5f97\u662f apache \u81ea\u5df1\u7684\u4e00\u4e2a\u6a21\u5757\uff0c\u800c fast_cgi\uff0cwsgi \u8fd9\u79cd\u90fd\u662f\u53e6\u5916\u4f1a\u8d77\u4e00\u4e2a\u8fdb\u7a0b\uff0c\u8fdb\u7a0b\u95f4\u901a\u4fe1\u3002<\/p>\n<p>\u6211\u611f\u89c9\u8981\u641e\u660e\u767d\u5f97\u82b1 1~2 \u5468\uff1f\u4f60\u5f97\u81ea\u5df1\u5199\u5199 CGI \u4ec0\u4e48\u7684\u3002\u53e6\u5916\u4f60\u53ef\u4ee5\u770b\u770b flask \u6587\u6863\u7684\u51e0\u79cd\u90e8\u7f72\u65b9\u5f0f\uff0c\u5bf9\u4f60\u7406\u89e3\u8fd9\u4e2a\u5e94\u8be5\u4e5f\u6709\u5e2e\u52a9\u3002\uff08\u6700\u540e\u4e00\u4e2a\u94fe\u63a5\u7684\u5185\u5bb9\u6bd4\u8f83\u91cd\u8981\uff09                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4127992\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : johnsona <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             1.\u4f60\u8981\u533a\u5206 http \u670d\u52a1\u5668\u548c\u5e94\u7528\u6846\u67b6\u3002http \u670d\u52a1\u5668\u662f\u63a5\u6536 http \u8bf7\u6c42\uff0c\u7136\u540e\u8c03\u7528\u4f60\u5199\u7684\u6846\u67b6\u903b\u8f91\uff08\u6bd4\u5982 flask \uff09\uff0c\u5904\u7406\u8bf7\u6c42\uff0c\u8fd4\u56de\u7ed3\u679c\u3002http \u670d\u52a1\u5668\u548c\u5e94\u7528\u6846\u67b6\u4e4b\u95f4\u4ea4\u4e92\u7684\u534f\u8bae\u5c31\u53eb wsgi\uff0c\u534f\u8bae\u5177\u4f53\u6765\u8bf4\u5c31\u662f http \u670d\u52a1\u5668\u628a\u8bf7\u6c42\u548c\u56de\u8c03\u51fd\u6570\u7ed9\u5e94\u7528\u6846\u67b6\uff0c\u5e94\u7528\u6846\u67b6\u5904\u7406\u5b8c\u8bf7\u6c42\u4e4b\u540e\uff0c\u6267\u884c http \u670d\u52a1\u5668\u7ed9\u7684\u56de\u8c03\u51fd\u6570\uff0c\u628a\u7ed3\u679c\u7ed9\u5230 http \u670d\u52a1\u5668\uff0chttp \u670d\u52a1\u5668\u8fd4\u56de\u7ed3\u679c\u7ed9\u524d\u7aef\u3002<br \/>2.flask django \u90fd\u81ea\u5e26\u4e86 http \u670d\u52a1\u5668\u5728\u91cc\u9762\uff0c\u4f46\u662f\u4e0d\u591f\u597d\uff0c\u4e0d\u591f\u7a33\u5b9a\uff0c\u5e76\u53d1\u4e0d\u591f\u9ad8\u7b49\u7b49<br \/>\u6240\u4ee5\u4e00\u822c\u7528 uwsgi \u6216\u8005 gunicorn \u8fd9\u79cd http \u670d\u52a1\u5668\u66ff\u4ee3<br \/>3.nginx \u53ef\u7528\u53ef\u4e0d\u7528\uff0c\u4e00\u822c\u6765\u8bf4 nginx \u662f\u4f5c\u4e3a uwsgi \u6216\u8005 gunicorn \u8fd9\u79cd http \u670d\u52a1\u5668\u7684\u53cd\u5411\u4ee3\u7406\uff0c\u5c31\u662f\u8bf4 nginx \u628a\u8bf7\u6c42\u62ff\u5230\u4e86\uff0c\u7ed9\u5230 gunicorn\uff0cgunicorn \u8c03\u7528 flask \u4ee3\u7801\u6267\u884c\u903b\u8f91\u3002nginx,uwsig,gunicorn \u3002\u4ed6\u4eec\u90fd\u662f http \u670d\u52a1\u5668\uff0c\u6216\u8005\u6709\u65f6\u5019\u53c8\u53eb gunicorn \u8fd9\u79cd\u53eb\u5e94\u7528\u670d\u52a1\u5668\u3002\u4e3a\u4ec0\u4e48\u8981\u7528\uff1f\u56e0\u4e3a nginx \u80fd\u5904\u7406\u5f88\u9ad8\u7684\u5e76\u53d1\uff0c\u800c\u4e14 nginx \u5728\u52a0\u8f7d\u9759\u6001\u8d44\u6e90\u6bd4\u5982 html,css,js \u65f6\u5019\u975e\u5e38\u5feb\uff0c\u5f53\u7136\u52a0\u8f7d\u9759\u6001\u8d44\u6e90\u5c31\u4e0d\u53eb\u53cd\u5411\u4ee3\u7406\u4e86\uff0c\u5c31\u662f\u53bb\u6253\u5f00 html \u8fd9\u4e9b\u6587\u4ef6\u8fd4\u56de\u7ed9\u5ba2\u6237\u7aef\u800c\u5df2                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4127993\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ManjusakaL <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u56e0\u4e3a\u81ea\u5e26\u7684\u4e0d\u5177\u5907\u751f\u4ea7\u53ef\u7528\u6027\u3002\u3002\u3002\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4127994\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ManjusakaL <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             BTW WSGI \u53ea\u662f\u4e00\u4e2a\u6807\u51c6\u800c\u5df2<\/p>\n<p>\u5176\u5b9e\u73b0\u6709\u5f88\u591a\u79cd\uff0c\u751f\u4ea7\u5e38\u7528\u7684 uWSGI\uff0cGunicron\uff0cWeb Framework \u81ea\u5e26\u7684 \u5982 Flask \u7684 Werkzurg\uff0cPython \u5b98\u65b9\u5e93\u5185\u7f6e\u7684 wsgiref \u7b49                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4127995\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : volvo007 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u4e2a\u95ee\u9898\u6211\u4e5f\u60f3\u8fc7\u5f88\u4e45\uff0c\u4e00\u5f00\u59cb\u4e5f\u662f\u7cca\u6d82<\/p>\n<p>flask \u81ea\u5e26\u4e00\u4e2a wsgi \u6846\u67b6\uff0c\u8fd9\u4e2a\u6d4b\u8bd5\u6846\u67b6\u51b3\u5b9a\u4e86\u7528\u6237\u53ef\u4ee5\u901a\u8fc7 flask run \u8dd1\u4e00\u4e2a server \u8ba9\u5176\u4ed6\u4eba\u8bbf\u95ee<br \/>\u4f46\u662f\u8fd9\u4e2a\u6846\u67b6\u7684\u6027\u80fd\u5f88\u5dee\uff0c\u6491\u4e0d\u4f4f\u5f88\u591a\u7528\u6237\u8bbf\u95ee<\/p>\n<p>\u6240\u4ee5\u53ef\u4ee5\u7528\u5176\u4ed6 wsgi \u534f\u8bae\u7684 wsgi \u6846\u67b6\uff08\u6211\u6ca1\u8bb0\u9519\u7684\u8bdd\uff0cwsgi \u65e2\u53ef\u4ee5\u6307\u4e00\u79cd\u901a\u4fe1\u534f\u8bae\uff0c\u53c8\u53ef\u4ee5\u6307\u57fa\u4e8e\u8fd9\u79cd\u534f\u8bae\u7684\u4e00\u79cd\u7ec4\u4ef6\u7c7b\u578b\uff09<br \/>\u7528\u4e86\u8fd9\u4e9b\u6846\u67b6\u4e4b\u540e\uff0c\u6765\u81ea http\/https \u7684\u8bf7\u6c42\uff0c\u4f1a\u901a\u8fc7\u8fd9\u79cd\u534f\u8bae\u548c server \u901a\u4fe1\uff0c\u6bd4\u5982\u8fd4\u56de server \u4e0a\u7684\u67d0\u4e2a url \u4e0b\u7684\u7279\u5b9a\u9875\u9762\u7b49<\/p>\n<p>\u81f3\u4e8e nginx\uff0c\u4e3b\u8981\u662f\u4e3a\u4e86\u63d0\u9ad8\u627f\u8f7d\u91cf\uff0c\u57fa\u4e8e C \u7684\u3002\u53e6\u4e00\u65b9\u9762\uff0c\u5b83\u7684\u53cd\u5411\u4ee3\u7406\u53ef\u4ee5\u8ba9\u4f60\u5728\u90e8\u7f72\u7f51\u7ad9\u7684\u65f6\u5019\uff0c\u4e0d\u7528\u5199 www.abc.com:5555 \u8fd9\u79cd\u5e26\u7aef\u53e3\u7684\u4e1c\u897f\uff0c\u53ef\u4ee5\u8ba9 nginx \u53cd\u5411\u4ee3\u7406\uff1a\u6211\u53d1\u73b0\u6765\u81ea 80 \u548c 8080 \u7aef\u53e3\u7684\uff0c\u8bf7\u6c42 www.abc.com\/index \u7684\uff0c\u6211\u5c31\u6307\u5411\u540e\u53f0\u670d\u52a1\u672c\u8eab\u7684\u7aef\u53e3\u6bd4\u5982 5555\uff0c\u4ee5\u5b9e\u73b0\u7aef\u53e3\u9690\u85cf                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4127996\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : westoy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5bf9\u63a5\u5404\u79cd\u4e0a\u6e38\u534f\u8bae\u7684\u4e2d\u95f4\u6807\u51c6                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4127997\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zjsxwc <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             wsgi \u670d\u52a1\u5668\u662f \u5395\u6240<br \/>python \u4e1a\u52a1\u811a\u672c\u662f \u9a6c\u6876<\/p>\n<p>\u53cd\u6b63\u90fd\u662f\u7528\u6765\u62c9\u5c4e\u7684                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4127998\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : a719114136 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6700\u5927\u7684\u597d\u5904\u5c31\u662f\u5404\u79cd\u6846\u67b6\u4e0d\u9700\u8981\u5173\u5fc3 http \u76f8\u5173\u7684\u4e1c\u897f\uff0c\u4e0d\u9700\u8981\u81ea\u5df1\u5199\u76d1\u542c http \u670d\u52a1\u7684\u903b\u8f91\uff0c\u53ea\u9700\u8981\u8bbe\u8ba1\u597d\u6846\u67b6\u81ea\u8eab\u7684\u4e1c\u897f\u5c31\u884c\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4127999\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : julyclyde <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             WSGI \u662f\u5206\u79bb\u4e86\u670d\u52a1\u5668\uff08\u901a\u4fe1\u3001\u8fdb\u7a0b\u7ebf\u7a0b\u7ba1\u7406\uff09\u548c\u5e94\u7528\u7a0b\u5e8f\u7684\u63a5\u53e3<br \/>\u6846\u67b6\u662f\u62bd\u8c61\u4e86 WSGI \u4f20\u6765\u7684\u4fe1\u606f\uff0c\u5305\u88c5\u6210\u5e38\u89c1 Web \u6982\u5ff5\u7684\u8f6f\u4ef6                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4128000\" 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>                                                             WSGI\/ASGI \u90fd\u662f\u4e3a\u4e86\u8ba9\u4f60\u53ef\u4ee5\u4e0d\u7528\u76f4\u63a5\u9762\u5bf9 HTTP \u8fd9\u4e2a\u770b\u8d77\u6765\u7b80\u5355\uff0c\u5b9e\u73b0\u8d77\u6765\u5f88\u590d\u6742\u7684\u534f\u8bae\u7684\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4128001\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : UN2758 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @johnsona #4 \u611f\u8c22\u5927\u4f6c,\u60f3\u95ee\u4e00\u4e0b java \u7684 servlet \u548c springboot \u4e4b\u95f4\u7684\u5173\u7cfb\u5c31\u7c7b\u4f3c fastcgi \u548c flask?servlet \u4e5f\u662f\u5bf9 wsgi \u7684\u4e00\u79cd\u5b9e\u73b0\u5417?                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4128002\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : johnsona <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @UN2758 wsgi \u662f http server \u548c python web \u6846\u67b6\u4e4b\u95f4\u4ea4\u4e92\u7684\u534f\u8bae\u3002\u5168\u79f0\u662f Python Web Server Gateway Interface\uff0c\u5c31\u662f python \u7f51\u5173\u534f\u8bae\uff0c\u6240\u4ee5\u548c servlet \u4e0d\u4e00\u6837\u3002\u800c wsgi server \u5c31\u662f\u7b26\u5408 wsgi \u534f\u8bae\u7684 http \u670d\u52a1\u5668\uff0cpython web \u6846\u67b6\u5c31\u662f flask \u8fd9\u4e9b\u3002<br \/>\u5177\u4f53\u70b9\uff0c\u4f60\u53ef\u4ee5\u628a wsgi server \u7406\u89e3\u6210\u4e00\u4e2a\u7a0b\u5e8f\uff0c\u91cc\u9762\u5c31\u5f00\u4e86\u4e00\u4e2a socket \u5728 while \u5faa\u73af\u63a5\u53d7\u8bf7\u6c42\uff0c\u7136\u540e\u628a http \u8bf7\u6c42\u62a5\u6587\u76f4\u63a5\u7ed9 python web \u6846\u67b6\uff0cweb \u6846\u67b6\u6839\u636e http \u7684\u8bf7\u6c42\u7684 url\uff0c\u505a\u4e0d\u540c\u5904\u7406\uff0c\u8fd9\u53eb\u8def\u7531\uff0c \u5904\u7406\u5b8c\u4e86\uff0c\u6211\u518d\u628a\u7ed3\u679c\u53d8\u6210 http resposne \u7ed9 http \u670d\u52a1\u5668\uff0c\u8ba9\u4ed6\u7ed9\u5ba2\u6237\u7aef\uff0c\u600e\u4e48\u7ed9\uff0c\u5c31\u662f\u56de\u8c03\u51fd\u6570\u3002<\/p>\n<p>&#8220;`python<br \/>def app(environ, start_response):<br \/> data = b&#8221;Hello, World!n&#8221;<br \/> start_response(&#8220;200 OK&#8221;, [<br \/> (&#8220;Content-Type&#8221;, &#8220;text\/plain&#8221;),<br \/> (&#8220;Content-Length&#8221;, str(len(data)))<br \/> ])<br \/> return iter([data])<br \/>&#8220;`<br \/>\u611f\u89c9\u81ea\u5df1\u4e5f\u66f4\u6e05\u695a\u4e86\u5462<br \/>\u81f3\u4e8e servlet \u548c sprintboot\uff0c\u4e0d\u662f\u5f88\u6e05\u695a\uff0c\u5e94\u8be5\u5dee\u4e0d\u591a\uff0cspringboot \u662f\u7ea6\u5b9a\u5927\u4e8e\u914d\u7f6e\uff0c\u90fd\u628a\u670d\u52a1\u5668\u5305\u62ec\u8fdb\u53bb\u4e86\u597d\u50cf                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>wsgi \u6709\u4ec0\u4e48\u4f5c\u7528\uff1f \u8cc7\u6df1\u5927\u4f6c &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\/191789"}],"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=191789"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/191789\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=191789"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=191789"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=191789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}