{"id":998566,"date":"2024-12-27T09:34:15","date_gmt":"2024-12-27T01:34:15","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/998566.html"},"modified":"2024-12-27T09:34:17","modified_gmt":"2024-12-27T01:34:17","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8web%e8%b7%91python","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/998566.html","title":{"rendered":"\u5982\u4f55\u5728web\u8dd1python"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25073931\/d9ebc48b-6020-47c8-acc8-28ac0190fa87.webp\" alt=\"\u5982\u4f55\u5728web\u8dd1python\" \/><\/p>\n<p><p> <strong>\u5728Web\u4e0a\u8fd0\u884cPython\u7684\u65b9\u6cd5\u4e3b\u8981\u5305\u62ec\u4f7f\u7528Web\u6846\u67b6\u3001\u901a\u8fc7API\u63a5\u53e3\u3001\u5d4c\u5165Python\u89e3\u91ca\u5668\u3001\u4f7f\u7528\u5728\u7ebf\u5e73\u53f0\u548c\u5de5\u5177\u3002<\/strong>\u5728\u8fd9\u4e9b\u65b9\u6cd5\u4e2d\uff0c\u4f7f\u7528Web\u6846\u67b6\u662f\u6700\u4e3a\u5e38\u89c1\u548c\u6709\u6548\u7684\u65b9\u5f0f\u3002Web\u6846\u67b6\u5982Flask\u548cDjango\u5141\u8bb8\u5f00\u53d1\u8005\u4f7f\u7528Python\u7f16\u5199\u670d\u52a1\u5668\u7aef\u4ee3\u7801\uff0c\u5904\u7406HTTP\u8bf7\u6c42\uff0c\u751f\u6210\u52a8\u6001\u7f51\u9875\uff0c\u4ece\u800c\u5728Web\u73af\u5883\u4e2d\u8fd0\u884cPython\u4ee3\u7801\u3002\u4ee5\u4e0b\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528Web\u6846\u67b6\u5728Web\u4e0a\u8fd0\u884cPython\uff0c\u4ee5\u53ca\u5176\u4ed6\u65b9\u6cd5\u7684\u5b9e\u73b0\u7ec6\u8282\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4f7f\u7528WEB\u6846\u67b6<\/p>\n<\/p>\n<p><p>\u4f7f\u7528Web\u6846\u67b6\u662f\u5b9e\u73b0Web\u4e0a\u8fd0\u884cPython\u7684\u6700\u5e38\u89c1\u65b9\u6cd5\u4e4b\u4e00\u3002Python\u6709\u8bb8\u591a\u6d41\u884c\u7684Web\u6846\u67b6\uff0c\u5982Flask\u3001Django\u3001FastAPI\u7b49\u3002\u4ee5\u4e0b\u662f\u5173\u4e8e\u5982\u4f55\u5728Web\u4e0a\u4f7f\u7528\u8fd9\u4e9b\u6846\u67b6\u7684\u8be6\u7ec6\u8bf4\u660e\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>Flask\u6846\u67b6<\/strong><\/li>\n<\/ol>\n<p><p>Flask\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684Web\u6846\u67b6\uff0c\u975e\u5e38\u9002\u5408\u5c0f\u578b\u5e94\u7528\u7a0b\u5e8f\u548c\u5feb\u901f\u5f00\u53d1\u3002\u5b83\u7b80\u5355\u6613\u5b66\uff0c\u7075\u6d3b\u6027\u9ad8\uff0c\u56e0\u6b64\u975e\u5e38\u53d7\u6b22\u8fce\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u5b89\u88c5\u548c\u8bbe\u7f6e<\/strong>\uff1a\u9996\u5148\uff0c\u4f60\u9700\u8981\u5728\u7cfb\u7edf\u4e0a\u5b89\u88c5Flask\u3002\u53ef\u4ee5\u901a\u8fc7pip\u547d\u4ee4\u5b89\u88c5\uff1a<code>pip install flask<\/code>\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684Flask\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u57fa\u672c\u7528\u6cd5<\/strong>\uff1a\u521b\u5efa\u4e00\u4e2aPython\u6587\u4ef6\uff08\u5982app.py\uff09\uff0c\u7136\u540e\u7f16\u5199\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from flask import Flask<\/p>\n<p>app = Flask(__name__)<\/p>\n<p>@app.route(&#39;\/&#39;)<\/p>\n<p>def hello_world():<\/p>\n<p>    return &#39;Hello, World!&#39;<\/p>\n<p>if __name__ == &#39;__m<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>n__&#39;:<\/p>\n<p>    app.run(debug=True)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd0\u884c\u8be5\u6587\u4ef6\uff0cFlask\u4f1a\u542f\u52a8\u4e00\u4e2a\u5f00\u53d1\u670d\u52a1\u5668\uff0c\u4f60\u53ef\u4ee5\u5728\u6d4f\u89c8\u5668\u4e2d\u8bbf\u95ee<code>http:\/\/127.0.0.1:5000\/<\/code>\u67e5\u770b\u7ed3\u679c\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6269\u5c55\u548c\u529f\u80fd<\/strong>\uff1aFlask\u652f\u6301\u591a\u79cd\u6269\u5c55\uff0c\u53ef\u4ee5\u8f7b\u677e\u6dfb\u52a0\u6570\u636e\u5e93\u3001\u8868\u5355\u5904\u7406\u3001\u8eab\u4efd\u9a8c\u8bc1\u7b49\u529f\u80fd\u3002\u901a\u8fc7\u7075\u6d3b\u7684\u8def\u7531\u7cfb\u7edf\uff0c\u4f60\u53ef\u4ee5\u521b\u5efa\u590d\u6742\u7684Web\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<ol start=\"2\">\n<li><strong>Django\u6846\u67b6<\/strong><\/li>\n<\/ol>\n<p><p>Django\u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684Web\u6846\u67b6\uff0c\u9002\u5408\u5927\u578b\u548c\u590d\u6742\u7684Web\u5e94\u7528\u7a0b\u5e8f\u3002\u5b83\u63d0\u4f9b\u4e86\u8bb8\u591a\u5f00\u7bb1\u5373\u7528\u7684\u529f\u80fd\uff0c\u5982\u7528\u6237\u8ba4\u8bc1\u3001\u7ba1\u7406\u754c\u9762\u3001ORM\u7b49\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u5b89\u88c5\u548c\u8bbe\u7f6e<\/strong>\uff1a\u540c\u6837\u4f7f\u7528pip\u5b89\u88c5Django\uff1a<code>pip install django<\/code>\u3002\u7136\u540e\uff0c\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Django\u9879\u76ee\uff1a<code>django-admin startproject myproject<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u57fa\u672c\u7528\u6cd5<\/strong>\uff1a\u8fdb\u5165\u9879\u76ee\u76ee\u5f55\uff0c\u8fd0\u884c\u5f00\u53d1\u670d\u52a1\u5668\uff1a<code>python manage.py runserver<\/code>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cDjango\u4f1a\u5728<code>http:\/\/127.0.0.1:8000\/<\/code>\u542f\u52a8\u4e00\u4e2a\u5f00\u53d1\u670d\u52a1\u5668\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7ed3\u6784\u548c\u529f\u80fd<\/strong>\uff1aDjango\u5177\u6709\u6e05\u6670\u7684\u9879\u76ee\u7ed3\u6784\uff0c\u5206\u4e3a\u5e94\u7528\u7a0b\u5e8f\u3001\u89c6\u56fe\u3001\u6a21\u578b\u548c\u6a21\u677f\u3002\u4f60\u53ef\u4ee5\u6839\u636e\u9700\u6c42\u521b\u5efa\u4e0d\u540c\u7684\u5e94\u7528\uff0c\u5e76\u901a\u8fc7\u89c6\u56fe\u548cURL\u914d\u7f6e\u5904\u7406\u8bf7\u6c42\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<ol start=\"3\">\n<li><strong>FastAPI\u6846\u67b6<\/strong><\/li>\n<\/ol>\n<p><p>FastAPI\u662f\u4e00\u4e2a\u73b0\u4ee3\u7684Web\u6846\u67b6\uff0c\u4e13\u6ce8\u4e8e\u9ad8\u6027\u80fd\u548c\u6613\u7528\u6027\uff0c\u9002\u5408\u6784\u5efaAPI\u548c\u5fae\u670d\u52a1\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u5b89\u88c5\u548c\u8bbe\u7f6e<\/strong>\uff1a\u901a\u8fc7pip\u5b89\u88c5FastAPI\u548cASGI\u670d\u52a1\u5668\uff08\u5982uvicorn\uff09\uff1a<code>pip install fastapi uvicorn<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u57fa\u672c\u7528\u6cd5<\/strong>\uff1a\u521b\u5efa\u4e00\u4e2aPython\u6587\u4ef6\uff08\u5982main.py\uff09\uff0c\u7136\u540e\u7f16\u5199\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from fastapi import FastAPI<\/p>\n<p>app = FastAPI()<\/p>\n<p>@app.get(&#39;\/&#39;)<\/p>\n<p>def read_root():<\/p>\n<p>    return {&#39;Hello&#39;: &#39;World&#39;}<\/p>\n<p>if __name__ == &#39;__main__&#39;:<\/p>\n<p>    import uvicorn<\/p>\n<p>    uvicorn.run(app, host=&#39;127.0.0.1&#39;, port=8000)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f18\u52bf\u548c\u7279\u70b9<\/strong>\uff1aFastAPI\u652f\u6301\u81ea\u52a8\u751f\u6210API\u6587\u6863\uff0c\u5177\u6709\u5feb\u901f\u7684\u6027\u80fd\u548c\u9ad8\u6548\u7684\u8bf7\u6c42\u5904\u7406\u80fd\u529b\uff0c\u975e\u5e38\u9002\u5408\u6784\u5efa\u73b0\u4ee3Web\u5e94\u7528\u548cAPI\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<p><p>\u4e8c\u3001\u901a\u8fc7API\u63a5\u53e3<\/p>\n<\/p>\n<p><p>\u5728Web\u4e0a\u8fd0\u884cPython\u7684\u53e6\u4e00\u79cd\u65b9\u6cd5\u662f\u901a\u8fc7API\u63a5\u53e3\u3002\u8fd9\u79cd\u65b9\u6cd5\u5c24\u5176\u9002\u5408\u9700\u8981\u4e0e\u5176\u4ed6\u7cfb\u7edf\u96c6\u6210\u6216\u63d0\u4f9b\u6570\u636e\u670d\u52a1\u7684\u573a\u666f\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>\u521b\u5efaRESTful API<\/strong><\/li>\n<\/ol>\n<p><p>\u4f7f\u7528Web\u6846\u67b6\u5982Flask\u3001Django REST Framework\u6216FastAPI\uff0c\u53ef\u4ee5\u8f7b\u677e\u521b\u5efaRESTful API\u3002\u8fd9\u4e9bAPI\u53ef\u4ee5\u5904\u7406HTTP\u8bf7\u6c42\uff0c\u8fd4\u56deJSON\u683c\u5f0f\u7684\u6570\u636e\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>Flask RESTful API<\/strong>\uff1a\u53ef\u4ee5\u5728Flask\u5e94\u7528\u4e2d\u4f7f\u7528Flask-RESTful\u6269\u5c55\u6765\u521b\u5efaRESTful API\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from flask import Flask<\/p>\n<p>from flask_restful import Resource, Api<\/p>\n<p>app = Flask(__name__)<\/p>\n<p>api = Api(app)<\/p>\n<p>class HelloWorld(Resource):<\/p>\n<p>    def get(self):<\/p>\n<p>        return {&#39;hello&#39;: &#39;world&#39;}<\/p>\n<p>api.add_resource(HelloWorld, &#39;\/&#39;)<\/p>\n<p>if __name__ == &#39;__main__&#39;:<\/p>\n<p>    app.run(debug=True)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>Django REST Framework<\/strong>\uff1a\u4f7f\u7528Django REST Framework\u53ef\u4ee5\u5feb\u901f\u5f00\u53d1RESTful API\u3002\u901a\u8fc7\u5b9a\u4e49\u5e8f\u5217\u5316\u5668\u548c\u89c6\u56fe\u96c6\uff0c\u53ef\u4ee5\u8f7b\u677e\u5904\u7406\u6570\u636e\u5e76\u8fd4\u56de\u54cd\u5e94\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<ol start=\"2\">\n<li><strong>\u4f7f\u7528GraphQL<\/strong><\/li>\n<\/ol>\n<p><p>GraphQL\u662f\u4e00\u79cd\u7075\u6d3b\u7684\u6570\u636e\u67e5\u8be2\u8bed\u8a00\uff0c\u53ef\u4ee5\u66ff\u4ee3\u4f20\u7edf\u7684RESTful API\u3002\u4f7f\u7528GraphQL\uff0c\u53ef\u4ee5\u5728\u4e00\u6b21\u8bf7\u6c42\u4e2d\u83b7\u53d6\u6240\u9700\u7684\u6240\u6709\u6570\u636e\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>Graphene-Django<\/strong>\uff1a\u5728Django\u4e2d\u4f7f\u7528Graphene\u5e93\uff0c\u53ef\u4ee5\u8f7b\u677e\u5b9e\u73b0GraphQL API\u3002\u901a\u8fc7\u5b9a\u4e49\u6a21\u5f0f\u548c\u67e5\u8be2\uff0c\u53ef\u4ee5\u5904\u7406\u5ba2\u6237\u7aef\u8bf7\u6c42\u5e76\u8fd4\u56de\u6570\u636e\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>Ariadne for Flask<\/strong>\uff1a\u5728Flask\u4e2d\u4f7f\u7528Ariadne\u5e93\uff0c\u53ef\u4ee5\u521b\u5efaGraphQL API\uff0c\u652f\u6301\u590d\u6742\u7684\u67e5\u8be2\u548c\u8ba2\u9605\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<p><p>\u4e09\u3001\u5d4c\u5165PYTHON\u89e3\u91ca\u5668<\/p>\n<\/p>\n<p><p>\u5d4c\u5165Python\u89e3\u91ca\u5668\u662f\u5728Web\u5e94\u7528\u4e2d\u8fd0\u884cPython\u4ee3\u7801\u7684\u53e6\u4e00\u79cd\u65b9\u6cd5\u3002\u8fd9\u901a\u5e38\u7528\u4e8e\u9700\u8981\u5728Web\u73af\u5883\u4e2d\u6267\u884cPython\u811a\u672c\u6216\u4ee3\u7801\u7247\u6bb5\u7684\u573a\u666f\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>\u5728Web\u9875\u9762\u4e2d\u5d4c\u5165Python<\/strong><\/li>\n<\/ol>\n<p><p>\u4f7f\u7528Pyodide\u6216Brython\u7b49\u5de5\u5177\uff0c\u53ef\u4ee5\u5728Web\u6d4f\u89c8\u5668\u4e2d\u76f4\u63a5\u8fd0\u884cPython\u4ee3\u7801\u3002Pyodide\u662f\u4e00\u4e2a\u5c06Python\u89e3\u91ca\u5668\u7f16\u8bd1\u4e3aWebAssembly\u7684\u9879\u76ee\uff0c\u652f\u6301\u5728\u6d4f\u89c8\u5668\u4e2d\u6267\u884cPython\u4ee3\u7801\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>Pyodide<\/strong>\uff1a\u53ef\u4ee5\u5c06Python\u4ee3\u7801\u5d4c\u5165HTML\u9875\u9762\uff0c\u901a\u8fc7JavaScript\u4e0ePython\u4ea4\u4e92\u3002Pyodide\u652f\u6301\u5927\u591a\u6570Python\u5e93\uff0c\u53ef\u4ee5\u5904\u7406\u79d1\u5b66\u8ba1\u7b97\u3001\u6570\u636e\u5206\u6790\u7b49\u4efb\u52a1\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>Brython<\/strong>\uff1aBrython\u662f\u4e00\u4e2a\u5c06Python\u7f16\u8bd1\u4e3aJavaScript\u7684\u9879\u76ee\uff0c\u5141\u8bb8\u5728\u6d4f\u89c8\u5668\u4e2d\u76f4\u63a5\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<ol start=\"2\">\n<li><strong>\u5728\u670d\u52a1\u5668\u7aef\u5d4c\u5165Python<\/strong><\/li>\n<\/ol>\n<p><p>\u5728\u670d\u52a1\u5668\u7aef\uff0c\u53ef\u4ee5\u4f7f\u7528\u5d4c\u5165\u5f0fPython\u89e3\u91ca\u5668\u8fd0\u884cPython\u4ee3\u7801\u3002\u8fd9\u901a\u5e38\u7528\u4e8e\u9700\u8981\u52a8\u6001\u751f\u6210\u5185\u5bb9\u6216\u5904\u7406\u590d\u6742\u903b\u8f91\u7684\u573a\u666f\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u4f7f\u7528C++\u5d4c\u5165Python<\/strong>\uff1a\u53ef\u4ee5\u5728C++\u5e94\u7528\u4e2d\u5d4c\u5165Python\u89e3\u91ca\u5668\uff0c\u901a\u8fc7Python\/C API\u8c03\u7528Python\u4ee3\u7801\u3002\u8fd9\u6837\u53ef\u4ee5\u5728\u9ad8\u6027\u80fd\u5e94\u7528\u4e2d\u96c6\u6210Python\u7684\u7075\u6d3b\u6027\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528Java\u5d4c\u5165Python<\/strong>\uff1a\u53ef\u4ee5\u5728Java\u5e94\u7528\u4e2d\u4f7f\u7528Jython\u6216Py4J\u7b49\u5e93\u5d4c\u5165Python\u89e3\u91ca\u5668\uff0c\u652f\u6301Java\u4e0ePython\u7684\u53cc\u5411\u4ea4\u4e92\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<p><p>\u56db\u3001\u4f7f\u7528\u5728\u7ebf\u5e73\u53f0\u548c\u5de5\u5177<\/p>\n<\/p>\n<p><p>\u5728\u7ebf\u5e73\u53f0\u548c\u5de5\u5177\u53ef\u4ee5\u8ba9\u5f00\u53d1\u8005\u5728Web\u73af\u5883\u4e2d\u8fd0\u884cPython\u4ee3\u7801\uff0c\u8fd9\u4e9b\u5de5\u5177\u901a\u5e38\u63d0\u4f9b\u4ea4\u4e92\u5f0f\u7f16\u7a0b\u73af\u5883\u548c\u4e30\u5bcc\u7684\u529f\u80fd\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>Google Colab<\/strong><\/li>\n<\/ol>\n<p><p>Google Colab\u662f\u4e00\u4e2a\u514d\u8d39\u7684\u5728\u7ebfJupyter Notebook\u73af\u5883\uff0c\u652f\u6301Python\u7f16\u7a0b\u548c\u6570\u636e\u79d1\u5b66\u4efb\u52a1\u3002Colab\u63d0\u4f9bGPU\u52a0\u901f\uff0c\u53ef\u4ee5\u6267\u884c\u590d\u6742\u7684\u8ba1\u7b97\u4efb\u52a1\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u4f7f\u7528Colab\u7f16\u5199\u4ee3\u7801<\/strong>\uff1a\u5728Colab\u4e2d\uff0c\u53ef\u4ee5\u521b\u5efa\u548c\u5206\u4eabJupyter Notebook\uff0c\u7f16\u5199Python\u4ee3\u7801\uff0c\u4f7f\u7528\u4e30\u5bcc\u7684\u5e93\u548c\u5de5\u5177\u5904\u7406\u6570\u636e\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4e0eGoogle Drive\u96c6\u6210<\/strong>\uff1aColab\u4e0eGoogle Drive\u96c6\u6210\uff0c\u53ef\u4ee5\u8f7b\u677e\u5b58\u50a8\u548c\u5171\u4eabNotebook\u6587\u4ef6\uff0c\u652f\u6301\u591a\u4eba\u534f\u4f5c\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<ol start=\"2\">\n<li><strong>Repl.it<\/strong><\/li>\n<\/ol>\n<p><p>Repl.it\u662f\u4e00\u4e2a\u5728\u7ebf\u7f16\u7a0b\u5e73\u53f0\uff0c\u652f\u6301\u591a\u79cd\u7f16\u7a0b\u8bed\u8a00\uff0c\u5305\u62ecPython\u3002Repl.it\u63d0\u4f9b\u5728\u7ebf\u7f16\u8f91\u5668\u548c\u7ec8\u7aef\uff0c\u53ef\u4ee5\u8fd0\u884cPython\u4ee3\u7801\u5e76\u67e5\u770b\u8f93\u51fa\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u521b\u5efa\u548c\u5206\u4eab\u9879\u76ee<\/strong>\uff1a\u5728Repl.it\u4e2d\uff0c\u53ef\u4ee5\u521b\u5efaPython\u9879\u76ee\uff0c\u7f16\u5199\u4ee3\u7801\uff0c\u8fd0\u884c\u7a0b\u5e8f\u3002Repl.it\u652f\u6301\u9879\u76ee\u5206\u4eab\u548c\u534f\u4f5c\u5f00\u53d1\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u96c6\u6210\u7b2c\u4e09\u65b9\u5e93<\/strong>\uff1aRepl.it\u652f\u6301\u5b89\u88c5\u548c\u4f7f\u7528Python\u7b2c\u4e09\u65b9\u5e93\uff0c\u53ef\u4ee5\u5728Web\u73af\u5883\u4e2d\u8fd0\u884c\u590d\u6742\u7684Python\u5e94\u7528\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<ol start=\"3\">\n<li><strong>JupyterHub<\/strong><\/li>\n<\/ol>\n<p><p>JupyterHub\u662f\u4e00\u4e2a\u591a\u7528\u6237Jupyter Notebook\u670d\u52a1\uff0c\u9002\u5408\u56e2\u961f\u548c\u6559\u80b2\u673a\u6784\u4f7f\u7528\u3002JupyterHub\u53ef\u4ee5\u90e8\u7f72\u5728\u670d\u52a1\u5668\u4e0a\uff0c\u63d0\u4f9b\u5728\u7ebf\u7f16\u7a0b\u73af\u5883\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u90e8\u7f72\u548c\u7ba1\u7406<\/strong>\uff1aJupyterHub\u652f\u6301\u7528\u6237\u7ba1\u7406\u548c\u6743\u9650\u63a7\u5236\uff0c\u53ef\u4ee5\u5728\u670d\u52a1\u5668\u4e0a\u90e8\u7f72Notebook\u670d\u52a1\uff0c\u4e3a\u591a\u4e2a\u7528\u6237\u63d0\u4f9b\u5728\u7ebf\u7f16\u7a0b\u73af\u5883\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u81ea\u5b9a\u4e49\u548c\u6269\u5c55<\/strong>\uff1aJupyterHub\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e\u548c\u6269\u5c55\uff0c\u53ef\u4ee5\u6839\u636e\u9700\u6c42\u6dfb\u52a0\u63d2\u4ef6\u548c\u529f\u80fd\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u65b9\u6cd5\uff0c\u4f60\u53ef\u4ee5\u5728Web\u4e0a\u8fd0\u884cPython\uff0c\u5b9e\u73b0\u5404\u79cd\u5e94\u7528\u9700\u6c42\u3002\u6bcf\u79cd\u65b9\u6cd5\u90fd\u6709\u5176\u9002\u7528\u7684\u573a\u666f\u548c\u4f18\u52bf\uff0c\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u53ef\u4ee5\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u548c\u5e94\u7528\u6027\u80fd\u3002\u65e0\u8bba\u662f\u4f7f\u7528Web\u6846\u67b6\u521b\u5efa\u52a8\u6001\u7f51\u7ad9\uff0c\u8fd8\u662f\u901a\u8fc7API\u63a5\u53e3\u63d0\u4f9b\u6570\u636e\u670d\u52a1\uff0c\u6216\u662f\u5d4c\u5165Python\u89e3\u91ca\u5668\u6267\u884c\u4ee3\u7801\u7247\u6bb5\uff0c\u90fd\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5728Web\u73af\u5883\u4e2d\u5145\u5206\u53d1\u6325Python\u7684\u5f3a\u5927\u529f\u80fd\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u9009\u62e9\u9002\u5408\u7684\u6846\u67b6\u6765\u5728Web\u4e0a\u8fd0\u884cPython\uff1f<\/strong><br \/>\u9009\u62e9\u9002\u5408\u7684\u6846\u67b6\u53d6\u51b3\u4e8e\u9879\u76ee\u7684\u9700\u6c42\u548c\u4e2a\u4eba\u7684\u6280\u672f\u80cc\u666f\u3002\u5982\u679c\u9700\u8981\u5feb\u901f\u5f00\u53d1\u548c\u7b80\u6d01\u7684\u4ee3\u7801\uff0cFlask\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684\u6846\u67b6\uff0c\u9002\u5408\u5c0f\u578b\u5e94\u7528\u3002\u800cDjango\u5219\u662f\u4e00\u4e2a\u529f\u80fd\u5168\u9762\u7684\u6846\u67b6\uff0c\u9002\u5408\u9700\u8981\u590d\u6742\u529f\u80fd\u7684\u9879\u76ee\u3002\u8fd8\u6709\u50cfFastAPI\u8fd9\u6837\u7684\u6846\u67b6\uff0c\u7279\u522b\u9002\u5408\u6784\u5efa\u9ad8\u6027\u80fd\u7684API\u3002\u6839\u636e\u9879\u76ee\u7684\u89c4\u6a21\u548c\u590d\u6742\u6027\uff0c\u9009\u62e9\u6700\u5408\u9002\u7684\u6846\u67b6\u80fd\u591f\u6709\u6548\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u3002<\/p>\n<p><strong>\u5728Web\u4e0a\u8fd0\u884cPython\u9700\u8981\u54ea\u4e9b\u73af\u5883\u914d\u7f6e\uff1f<\/strong><br \/>\u4e3a\u4e86\u5728Web\u4e0a\u8fd0\u884cPython\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5Python\u73af\u5883\u3002\u4e4b\u540e\uff0c\u53ef\u4ee5\u9009\u62e9\u5408\u9002\u7684Web\u670d\u52a1\u5668\uff0c\u5982Gunicorn\u3001uWSGI\u7b49\uff0c\u6765\u90e8\u7f72\u5e94\u7528\u3002\u8fd8\u9700\u914d\u7f6e\u6570\u636e\u5e93\u8fde\u63a5\uff0c\u4f8b\u5982\u4f7f\u7528SQLite\u6216PostgreSQL\u3002\u786e\u4fdd\u5b89\u88c5\u5fc5\u8981\u7684\u5e93\u548c\u4f9d\u8d56\u9879\uff0c\u5e76\u914d\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u4ee5\u786e\u4fdd\u5e94\u7528\u7a0b\u5e8f\u7684\u6b63\u5e38\u8fd0\u884c\u3002<\/p>\n<p><strong>\u5982\u4f55\u63d0\u9ad8\u5728Web\u4e0a\u8fd0\u884cPython\u5e94\u7528\u7684\u6027\u80fd\uff1f<\/strong><br \/>\u63d0\u5347Python Web\u5e94\u7528\u6027\u80fd\u7684\u65b9\u6cd5\u6709\u591a\u79cd\u3002\u4f18\u5316\u4ee3\u7801\u903b\u8f91\u3001\u4f7f\u7528\u7f13\u5b58\u673a\u5236\uff08\u5982Redis\u6216Memcached\uff09\u3001\u9009\u62e9\u5408\u9002\u7684\u6570\u636e\u5e93\u7d22\u5f15\u4ee5\u53ca\u4f7f\u7528\u5f02\u6b65\u7f16\u7a0b\uff08\u4f8b\u5982\u4f7f\u7528FastAPI\u6216Tornado\uff09\u90fd\u662f\u6709\u6548\u7684\u7b56\u7565\u3002\u6b64\u5916\uff0c\u5b9a\u671f\u76d1\u63a7\u5e94\u7528\u7684\u6027\u80fd\u548c\u8d1f\u8f7d\u60c5\u51b5\uff0c\u5e76\u8fdb\u884c\u76f8\u5e94\u7684\u8c03\u4f18\uff0c\u53ef\u4ee5\u663e\u8457\u63d0\u9ad8\u7528\u6237\u4f53\u9a8c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Web\u4e0a\u8fd0\u884cPython\u7684\u65b9\u6cd5\u4e3b\u8981\u5305\u62ec\u4f7f\u7528Web\u6846\u67b6\u3001\u901a\u8fc7API\u63a5\u53e3\u3001\u5d4c\u5165Python\u89e3\u91ca\u5668\u3001\u4f7f\u7528\u5728\u7ebf\u5e73\u53f0\u548c [&hellip;]","protected":false},"author":3,"featured_media":998574,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/998566"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=998566"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/998566\/revisions"}],"predecessor-version":[{"id":998577,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/998566\/revisions\/998577"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/998574"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=998566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=998566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=998566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}