{"id":35001,"date":"2025-05-01T18:30:43","date_gmt":"2025-05-01T10:30:43","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/35001.html"},"modified":"2025-05-01T18:30:43","modified_gmt":"2025-05-01T10:30:43","slug":"asgi-%e6%9c%8d%e5%8a%a1%e5%99%a8uvicorn%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/35001.html","title":{"rendered":"ASGI \u670d\u52a1\u5668Uvicorn\u4ecb\u7ecd"},"content":{"rendered":"<h4>\u4e00\u3001Uvicorn \u662f\u4ec0\u4e48&#xff1f;<\/h4>\n<ul>\n<li>ASGI \u670d\u52a1\u5668&#xff1a;\u7528\u4e8e\u8fd0\u884c\u5f02\u6b65 Web \u5e94\u7528\u3002\u5bf9\u6bd4\u4f20\u7edf\u7684 WSGI \u670d\u52a1\u5668&#xff0c;\u6bd4\u5982 Gunicorn&#xff0c;Uvicorn \u652f\u6301\u5f02\u6b65\u64cd\u4f5c&#xff0c;\u9002\u5408 FastAPI \u6216 Starlette \u8fd9\u6837\u7684\u6846\u67b6&#xff1b; \u7b80\u8a00\u4e4b&#xff0c;Uvicorn \u662f\u4e13\u4e3a\u5f02\u6b65 Python Web \u6846\u67b6&#xff08;\u5982 FastAPI\u3001Starlette&#xff09;\u8bbe\u8ba1\u7684\u9ad8\u6027\u80fd\u670d\u52a1\u5668\u3002<\/li>\n<li>\u6838\u5fc3\u7279\u6027&#xff1a;\n<ul>\n<li>\u652f\u6301 HTTP\/1.1 \u548c WebSocket\u3002<\/li>\n<li>\u57fa\u4e8e uvloop \u548c httptools \u5b9e\u73b0\u9ad8\u6548 I\/O \u5904\u7406\u3002<\/li>\n<li>\u8f7b\u91cf\u7ea7&#xff0c;\u9002\u5408\u5f00\u53d1\u548c\u90e8\u7f72\u5f02\u6b65\u5e94\u7528\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>\u4e8c\u3001\u5b89\u88c5 Uvicorn<\/h4>\n<h5>1. \u57fa\u7840\u5b89\u88c5<\/h5>\n<p>pip install uvicorn <\/p>\n<h5>2. \u5b89\u88c5\u6027\u80fd\u4f18\u5316\u7248&#xff08;\u63a8\u8350&#xff09;<\/h5>\n<p>\u5305\u542b <span style=\"color:#fe2c24\">uvloop<\/span> \u548c <span style=\"color:#fe2c24\">httptools<\/span> \u4f9d\u8d56&#xff1a;<\/p>\n<p>pip install uvicorn[standard] <\/p>\n<p>\u4e09\u3001\u5feb\u901f\u542f\u52a8 FastAPI \u5e94\u7528<\/p>\n<h5>1. \u793a\u4f8b\u4ee3\u7801&#xff08;<span style=\"color:#fe2c24\">main.py<\/span>&#xff09;<\/h5>\n<p>from fastapi import FastAPI<\/p>\n<p>app &#061; FastAPI()<\/p>\n<p>&#064;app.get(&#034;\/&#034;)<br \/>\ndef home():<br \/>\n    return {&#034;message&#034;: &#034;Hello World&#034;} <\/p>\n<h5>2. \u542f\u52a8\u547d\u4ee4<\/h5>\n<p>uvicorn main:app &#8211;host 0.0.0.0 &#8211;port 8000 &#8211;reload <\/p>\n<ul>\n<li>\u53c2\u6570\u89e3\u6790&#xff1a;\n<ul>\n<li><span style=\"color:#fe2c24\">main:app<\/span>&#xff1a;<span style=\"color:#fe2c24\">main.py<\/span> \u6587\u4ef6\u4e2d\u7684 <span style=\"color:#fe2c24\">app <\/span>\u5b9e\u4f8b\u3002<\/li>\n<li><span style=\"color:#fe2c24\">&#8211;host 0.0.0.0<\/span>&#xff1a;\u5141\u8bb8\u6240\u6709 IP \u8bbf\u95ee\u3002<\/li>\n<li><span style=\"color:#fe2c24\">&#8211;port 8000<\/span>&#xff1a;\u76d1\u542c\u7aef\u53e3\u53f7\u3002<\/li>\n<li><span style=\"color:#fe2c24\">&#8211;reload<\/span>&#xff1a;\u4ee3\u7801\u4fee\u6539\u540e\u81ea\u52a8\u91cd\u542f&#xff08;\u4ec5\u7528\u4e8e\u5f00\u53d1\u73af\u5883&#xff09;\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>\u56db\u3001\u5e38\u7528\u547d\u4ee4\u884c\u53c2\u6570<\/h4>\n<table>\n<tr>\n<p>\u53c2\u6570<\/p>\n<p>\u8bf4\u660e<\/p>\n<\/tr>\n<tbody>\n<tr>\n<td>\n<p>&#8211;host<\/p>\n<\/td>\n<td>\n<p>\u7ed1\u5b9a\u4e3b\u673a\u5730\u5740&#xff08;\u9ed8\u8ba4127.0.0.1&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>&#8211;port<\/p>\n<\/td>\n<td>\n<p>\u76d1\u542c\u7aef\u53e3&#xff08;\u9ed8\u8ba48000&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>&#8211;workers<\/p>\n<\/td>\n<td>\n<p>\u5de5\u4f5c\u8fdb\u7a0b\u6570&#xff08;\u591a\u8fdb\u7a0b\u6a21\u5f0f&#xff0c;\u9700\u5173\u95ed&#8211;reload&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>&#8211;reload<\/p>\n<\/td>\n<td>\n<p>\u5f00\u53d1\u6a21\u5f0f\u4e0b\u81ea\u52a8\u91cd\u8f7d\u4ee3\u7801<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>&#8211;log-level<\/p>\n<\/td>\n<td>\n<p>\u65e5\u5fd7\u7ea7\u522b&#xff08;debug\/info\/warning\/error\/critical&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>&#8211;timeout-keep-alive<\/p>\n<\/td>\n<td>\n<p>\u4fdd\u6301\u8fde\u63a5\u8d85\u65f6\u65f6\u95f4&#xff08;\u79d2&#xff0c;\u9ed8\u8ba45&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>&#8211;ssl-keyfile<\/p>\n<\/td>\n<td>\n<p>SSL \u79c1\u94a5\u6587\u4ef6\u8def\u5f84&#xff08;\u542f\u7528 HTTPS&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>&#8211;ssl-certfile<\/p>\n<\/td>\n<td>\n<p>SSL \u8bc1\u4e66\u6587\u4ef6\u8def\u5f84&#xff08;\u542f\u7528 HTTPS&#xff09;<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>\u4e94\u3001\u751f\u4ea7\u73af\u5883\u90e8\u7f72<\/h4>\n<h5>1. \u5355\u8fdb\u7a0b\u8fd0\u884c<\/h5>\n<p>uvicorn main:app &#8211;host 0.0.0.0 &#8211;port 8000 <\/p>\n<h5>2. \u591a\u8fdb\u7a0b\u8fd0\u884c&#xff08;\u7ed3\u5408 Gunicorn&#xff09;<\/h5>\n<p>pip install gunicorn<\/p>\n<p>gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app <\/p>\n<ul>\n<li>\u53c2\u6570\u89e3\u6790&#xff1a;\n<ul>\n<li><span style=\"color:#fe2c24\">-w 4<\/span>&#xff1a;\u542f\u52a8 4 \u4e2a\u5de5\u4f5c\u8fdb\u7a0b&#xff08;\u901a\u5e38\u8bbe\u4e3a CPU \u6838\u5fc3\u6570 \u00d7 2 &#043; 1&#xff09;\u3002<\/li>\n<li><span style=\"color:#fe2c24\">-k uvicorn.workers.UvicornWorker<\/span>&#xff1a;\u6307\u5b9a Uvicorn \u5de5\u4f5c\u5668\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h5>3. \u4f7f\u7528 HTTPS<\/h5>\n<p>uvicorn main:app &#8211;ssl-keyfile key.pem &#8211;ssl-certfile cert.pem <\/p>\n<h4>\u516d\u3001\u6027\u80fd\u8c03\u4f18<\/h4>\n<h5>1. \u8d85\u65f6\u8bbe\u7f6e<\/h5>\n<p># \u51cf\u5c11\u7a7a\u95f2\u8fde\u63a5\u5360\u7528<\/p>\n<p>uvicorn main:app &#8211;timeout-keep-alive 10 <\/p>\n<h5>2. \u8c03\u6574\u65e5\u5fd7\u7ea7\u522b<\/h5>\n<p># \u751f\u4ea7\u73af\u5883\u5173\u95ed debug \u65e5\u5fd7<\/p>\n<p>uvicorn main:app &#8211;log-level warning <\/p>\n<h5>3. \u542f\u7528\u591a\u6838 CPU<\/h5>\n<p>uvicorn main:app &#8211;workers 4 <\/p>\n<p>\u4e03\u3001\u5e38\u89c1\u95ee\u9898\u89e3\u51b3<\/p>\n<h5>1. \u7aef\u53e3\u51b2\u7a81<\/h5>\n<p>Error: [Errno 98] Address already in use <\/p>\n<ul>\n<li>\u89e3\u51b3\u65b9\u6848&#xff1a;\u66f4\u6362\u7aef\u53e3 <span style=\"color:#fe2c24\">&#8211;port 8001<\/span> \u6216\u7ec8\u6b62\u5360\u7528\u8fdb\u7a0b&#xff1a;\n<p>\u00a0<\/p>\n<p> lsof -i :8000<\/p>\n<p>kill -9 &lt;PID&gt; <\/li>\n<\/ul>\n<h5>2. \u6a21\u5757\u5bfc\u5165\u9519\u8bef<\/h5>\n<p>Error: No module named &#039;main&#039; <\/p>\n<ul>\n<li>\u89e3\u51b3\u65b9\u6848&#xff1a;\u68c0\u67e5\u6587\u4ef6\u8def\u5f84\u548c\u53d8\u91cf\u540d&#xff0c;\u786e\u4fdd main:app \u6307\u5411\u6b63\u786e\u7684\u6a21\u5757\u548c\u5e94\u7528\u5b9e\u4f8b\u3002<\/li>\n<\/ul>\n<h5>3. SSL \u8bc1\u4e66\u9519\u8bef<\/h5>\n<p>SSL error: [SSL] PEM lib (_ssl.c:4013) <\/p>\n<ul>\n<li>\u89e3\u51b3\u65b9\u6848&#xff1a;\u786e\u4fdd\u8bc1\u4e66\u548c\u79c1\u94a5\u6587\u4ef6\u8def\u5f84\u6b63\u786e\u4e14\u683c\u5f0f\u4e3a PEM\u3002<\/li>\n<\/ul>\n<h4>\u516b\u3001\u603b\u7ed3<\/h4>\n<ul>\n<li>\u5f00\u53d1\u73af\u5883&#xff1a;\u4f7f\u7528<span style=\"color:#fe2c24\"> &#8211;reload <\/span>\u5b9e\u65f6\u8c03\u8bd5\u3002<\/li>\n<li>\u751f\u4ea7\u73af\u5883&#xff1a;\n<ul>\n<li>\u591a\u8fdb\u7a0b\u6a21\u5f0f&#xff08;<span style=\"color:#fe2c24\">&#8211;workers <\/span>\u6216 Gunicorn &#043; Uvicorn&#xff09;\u3002<\/li>\n<li>\u542f\u7528 HTTPS&#xff08;<span style=\"color:#fe2c24\">&#8211;ssl-keyfile <\/span>\u548c <span style=\"color:#fe2c24\">&#8211;ssl-certfile<\/span>&#xff09;\u3002<\/li>\n<li>\u8c03\u6574\u8d85\u65f6\u548c\u65e5\u5fd7\u7ea7\u522b\u4f18\u5316\u6027\u80fd\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb736\u6b21\uff0c\u70b9\u8d5e22\u6b21\uff0c\u6536\u85cf17\u6b21\u30022. \u5b89\u88c5\u6027\u80fd\u4f18\u5316\u7248\uff08\u63a8\u8350\uff09\u5305\u542b  \u548c  \u4f9d\u8d56\uff1a\u4e09\u3001\u5feb\u901f\u542f\u52a8 FastAPI \u5e94\u75282. \u542f\u52a8\u547d\u4ee4\t\u53c2\u6570\u89e3\u6790\uff1a\t\t\t\uff1a \u6587\u4ef6\u4e2d\u7684  \u5b9e\u4f8b\u3002\t\t\uff1a\u5141\u8bb8\u6240\u6709 IP \u8bbf\u95ee\u3002\t\t\uff1a\u76d1\u542c\u7aef\u53e3\u53f7\u3002\t\t\uff1a\u4ee3\u7801\u4fee\u6539\u540e\u81ea\u52a8\u91cd\u542f\uff08\u4ec5\u7528\u4e8e\u5f00\u53d1\u73af\u5883\uff09\u3002\t\t\u56db\u3001\u5e38\u7528\u547d\u4ee4\u884c\u53c2\u6570\t\t\t\t\t\t\t\t\t\u53c2\u6570\u8bf4\u660e\u7ed1\u5b9a\u4e3b\u673a\u5730\u5740\uff08\u9ed8\u8ba4\uff09\u76d1\u542c\u7aef\u53e3\uff08\u9ed8\u8ba4\uff09\u5de5\u4f5c\u8fdb\u7a0b\u6570\uff08\u591a\u8fdb\u7a0b\u6a21\u5f0f\uff0c\u9700\u5173\u95ed\uff09\u5f00\u53d1\u6a21\u5f0f\u4e0b\u81ea\u52a8\u91cd\u8f7d\u4ee3\u7801\u65e5\u5fd7\u7ea7\u522b\uff08\/\/\/\/\uff09\u4fdd\u6301\u8fde\u63a5\u8d85\u65f6\u65f6\u95f4\uff08\u79d2\uff0c\u9ed8\u8ba4\uff09SSL \u79c1\u94a5\u6587\u4ef6\u8def\u5f84\uff08\u542f\u7528 HTTPS<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[81,43],"topic":[],"class_list":["post-35001","post","type-post","status-publish","format-standard","hentry","category-server","tag-python","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>ASGI \u670d\u52a1\u5668Uvicorn\u4ecb\u7ecd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/35001.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ASGI \u670d\u52a1\u5668Uvicorn\u4ecb\u7ecd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb736\u6b21\uff0c\u70b9\u8d5e22\u6b21\uff0c\u6536\u85cf17\u6b21\u30022. \u5b89\u88c5\u6027\u80fd\u4f18\u5316\u7248\uff08\u63a8\u8350\uff09\u5305\u542b \u548c \u4f9d\u8d56\uff1a\u4e09\u3001\u5feb\u901f\u542f\u52a8 FastAPI \u5e94\u75282. \u542f\u52a8\u547d\u4ee4 \u53c2\u6570\u89e3\u6790\uff1a  \uff1a \u6587\u4ef6\u4e2d\u7684 \u5b9e\u4f8b\u3002 \uff1a\u5141\u8bb8\u6240\u6709 IP \u8bbf\u95ee\u3002 \uff1a\u76d1\u542c\u7aef\u53e3\u53f7\u3002 \uff1a\u4ee3\u7801\u4fee\u6539\u540e\u81ea\u52a8\u91cd\u542f\uff08\u4ec5\u7528\u4e8e\u5f00\u53d1\u73af\u5883\uff09\u3002 \u56db\u3001\u5e38\u7528\u547d\u4ee4\u884c\u53c2\u6570     \u53c2\u6570\u8bf4\u660e\u7ed1\u5b9a\u4e3b\u673a\u5730\u5740\uff08\u9ed8\u8ba4\uff09\u76d1\u542c\u7aef\u53e3\uff08\u9ed8\u8ba4\uff09\u5de5\u4f5c\u8fdb\u7a0b\u6570\uff08\u591a\u8fdb\u7a0b\u6a21\u5f0f\uff0c\u9700\u5173\u95ed\uff09\u5f00\u53d1\u6a21\u5f0f\u4e0b\u81ea\u52a8\u91cd\u8f7d\u4ee3\u7801\u65e5\u5fd7\u7ea7\u522b\uff08\/\/\/\/\uff09\u4fdd\u6301\u8fde\u63a5\u8d85\u65f6\u65f6\u95f4\uff08\u79d2\uff0c\u9ed8\u8ba4\uff09SSL \u79c1\u94a5\u6587\u4ef6\u8def\u5f84\uff08\u542f\u7528 HTTPS\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/35001.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-01T10:30:43+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/35001.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/35001.html\",\"name\":\"ASGI \u670d\u52a1\u5668Uvicorn\u4ecb\u7ecd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-05-01T10:30:43+00:00\",\"dateModified\":\"2025-05-01T10:30:43+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/35001.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/35001.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/35001.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ASGI \u670d\u52a1\u5668Uvicorn\u4ecb\u7ecd\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"ASGI \u670d\u52a1\u5668Uvicorn\u4ecb\u7ecd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/35001.html","og_locale":"zh_CN","og_type":"article","og_title":"ASGI \u670d\u52a1\u5668Uvicorn\u4ecb\u7ecd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb736\u6b21\uff0c\u70b9\u8d5e22\u6b21\uff0c\u6536\u85cf17\u6b21\u30022. \u5b89\u88c5\u6027\u80fd\u4f18\u5316\u7248\uff08\u63a8\u8350\uff09\u5305\u542b \u548c \u4f9d\u8d56\uff1a\u4e09\u3001\u5feb\u901f\u542f\u52a8 FastAPI \u5e94\u75282. \u542f\u52a8\u547d\u4ee4 \u53c2\u6570\u89e3\u6790\uff1a  \uff1a \u6587\u4ef6\u4e2d\u7684 \u5b9e\u4f8b\u3002 \uff1a\u5141\u8bb8\u6240\u6709 IP \u8bbf\u95ee\u3002 \uff1a\u76d1\u542c\u7aef\u53e3\u53f7\u3002 \uff1a\u4ee3\u7801\u4fee\u6539\u540e\u81ea\u52a8\u91cd\u542f\uff08\u4ec5\u7528\u4e8e\u5f00\u53d1\u73af\u5883\uff09\u3002 \u56db\u3001\u5e38\u7528\u547d\u4ee4\u884c\u53c2\u6570     \u53c2\u6570\u8bf4\u660e\u7ed1\u5b9a\u4e3b\u673a\u5730\u5740\uff08\u9ed8\u8ba4\uff09\u76d1\u542c\u7aef\u53e3\uff08\u9ed8\u8ba4\uff09\u5de5\u4f5c\u8fdb\u7a0b\u6570\uff08\u591a\u8fdb\u7a0b\u6a21\u5f0f\uff0c\u9700\u5173\u95ed\uff09\u5f00\u53d1\u6a21\u5f0f\u4e0b\u81ea\u52a8\u91cd\u8f7d\u4ee3\u7801\u65e5\u5fd7\u7ea7\u522b\uff08\/\/\/\/\uff09\u4fdd\u6301\u8fde\u63a5\u8d85\u65f6\u65f6\u95f4\uff08\u79d2\uff0c\u9ed8\u8ba4\uff09SSL \u79c1\u94a5\u6587\u4ef6\u8def\u5f84\uff08\u542f\u7528 HTTPS","og_url":"https:\/\/www.wsisp.com\/helps\/35001.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-05-01T10:30:43+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/35001.html","url":"https:\/\/www.wsisp.com\/helps\/35001.html","name":"ASGI \u670d\u52a1\u5668Uvicorn\u4ecb\u7ecd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-05-01T10:30:43+00:00","dateModified":"2025-05-01T10:30:43+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/35001.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/35001.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/35001.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"ASGI \u670d\u52a1\u5668Uvicorn\u4ecb\u7ecd"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/35001","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=35001"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/35001\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=35001"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=35001"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=35001"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=35001"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}