{"id":204258,"date":"2025-05-29T09:08:19","date_gmt":"2025-05-29T01:08:19","guid":{"rendered":"https:\/\/server.hk\/cnblog\/204258\/"},"modified":"2025-05-29T09:08:19","modified_gmt":"2025-05-29T01:08:19","slug":"bottle-python-%e8%bd%bb%e9%87%8f%e7%ba%a7%e5%bf%ab%e9%80%9f%e5%be%ae%e5%9e%8b-web-%e6%a1%86%e6%9e%b6","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/204258\/","title":{"rendered":"Bottle &#8211; Python \u8f7b\u91cf\u7ea7\u5feb\u901f\u5fae\u578b Web \u6846\u67b6"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>Bottle &#8211; Python \u8f7b\u91cf\u7ea7\u5feb\u901f\u5fae\u578b Web \u6846\u67b6<\/h1>\n<p>\u4eca\u65e5\u4e0d\u80af\u57cb\u5934\uff0c\u660e\u65e5\u4f55\u4ee5\u62ac\u5934\uff01\u6bcf\u65e5\u4e00\u53e5\u52aa\u529b\u81ea\u5df1\u7684\u8bdd\u54c8\u54c8~\u54c8\u55bd\uff0c\u4eca\u5929\u6211\u5c06\u7ed9\u5927\u5bb6\u5e26\u6765\u4e00\u7bc7<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300aBottle &#8211; Python \u8f7b\u91cf\u7ea7\u5feb\u901f\u5fae\u578b Web \u6846\u67b6\u300b<\/span>\uff0c\u4e3b\u8981\u5185\u5bb9\u662f\u8bb2\u89e3<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\uff0c\u611f\u5174\u8da3\u7684\u670b\u53cb\u53ef\u4ee5\u6536\u85cf\u6216\u8005\u6709\u66f4\u597d\u7684\u5efa\u8bae\u5728\u8bc4\u8bba\u63d0\u51fa\uff0c\u6211\u90fd\u4f1a\u8ba4\u771f\u770b\u7684\uff01\u5927\u5bb6\u4e00\u8d77\u8fdb\u6b65\uff0c\u4e00\u8d77\u5b66\u4e60\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241102\/17305385646725ec44c6ca2.jpg\" class=\"aligncenter\"><\/p>\n<p>bottle \u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u4e14\u5feb\u901f\u7684 python \u5fae\u578b web \u6846\u67b6\u3002\u5b83\u7684\u8bbe\u8ba1\u7b80\u5355\u6613\u7528\uff0c\u975e\u5e38\u9002\u5408\u5c0f\u578b web \u5e94\u7528\u7a0b\u5e8f\u3001\u539f\u578b\u6216 api\u3002<\/p>\n<p>\u4e3b\u8981\u7279\u70b9\uff1a<\/p>\n<ol>\n<li>\n<p>\u5355\u6587\u4ef6\u90e8\u7f72\uff1abottle \u53ef\u4ee5\u5b8c\u5168\u4ece\u5355\u4e2a python \u6587\u4ef6\u8fd0\u884c\uff0c\u9664\u4e86 python \u6807\u51c6\u5e93\u4e4b\u5916\u6ca1\u6709\u4efb\u4f55\u4f9d\u8d56\u9879\u3002\u8fd9\u4f7f\u5f97\u90e8\u7f72\u548c\u7ef4\u62a4\u5c0f\u578b\u9879\u76ee\u53d8\u5f97\u5bb9\u6613\u3002<\/p>\n<\/li>\n<li>\n<p>\u5185\u7f6e http \u670d\u52a1\u5668\uff1a\u5b83\u5e26\u6709\u5185\u7f6e\u670d\u52a1\u5668\uff0c\u4f46\u4e5f\u53ef\u4ee5\u914d\u7f6e\u4e3a\u5728\u5176\u4ed6 wsgi \u517c\u5bb9\u670d\u52a1\u5668\uff08\u5982 gunicorn \u6216 uwsgi\uff09\u4e0a\u8fd0\u884c\u3002<\/p>\n<\/li>\n<li>\n<p>\u8def\u7531\uff1abottle \u63d0\u4f9b\u7b80\u5355\u800c\u5f3a\u5927\u7684\u8def\u7531\u529f\u80fd\u3002\u5b83\u5c06 url \u6620\u5c04\u5230\u5904\u7406\u8bf7\u6c42\u5e76\u8fd4\u56de\u54cd\u5e94\u7684\u51fd\u6570\u3002<\/p>\n<\/li>\n<li>\n<p>\u6a21\u677f\uff1a\u5b83\u6709\u4e00\u4e2a\u5185\u7f6e\u7684\u6a21\u677f\u5f15\u64ce\uff0c\u8ba9\u60a8\u8f7b\u677e\u521b\u5efa\u52a8\u6001 html \u5185\u5bb9\u3002<\/p>\n<\/li>\n<li>\n<p>\u63d2\u4ef6\uff1abottle \u652f\u6301\u63d2\u4ef6\uff0c\u8fd9\u4e9b\u63d2\u4ef6\u662f\u53ef\u4ee5\u6dfb\u52a0\u4ee5\u6269\u5c55\u5176\u529f\u80fd\u7684\u7ec4\u4ef6\u3002\u5e38\u89c1\u63d2\u4ef6\u5305\u62ec\u5bf9 sqlite\u3001mysql \u6216 mongodb \u7b49\u6570\u636e\u5e93\u7684\u652f\u6301\u3002<\/p>\n<\/li>\n<li>\n<p>\u7b26\u5408 wsgi\uff1abottle \u5b8c\u5168\u7b26\u5408 wsgi\uff0c\u8fd9\u610f\u5473\u7740\u5b83\u53ef\u4ee5\u4e0e\u5176\u4ed6 wsgi \u517c\u5bb9\u7684\u5e94\u7528\u7a0b\u5e8f\u548c\u4e2d\u95f4\u4ef6\u96c6\u6210\u3002<\/p>\n<\/li>\n<\/ol>\n<hr>\n<ol>\n<li>\u5b89\u88c5\u74f6\u5b50<\/li>\n<\/ol>\n<p>\u5728\u5f00\u59cb\u4f7f\u7528 bottle \u4e4b\u524d\uff0c\u60a8\u9700\u8981\u5148\u5b89\u88c5\u5b83\u3002 bottle\u662f\u4e00\u4e2a\u7eafpython\u5305\uff0c\u5b89\u88c5\u5f88\u7b80\u5355\uff1a<\/p>\n<p>pip \u5b89\u88c5\u74f6\u5b50<\/p>\n<p>\u8fd9\u5c06\u5b89\u88c5 bottle \u6846\u67b6\u5e76\u4f7f\u5176\u53ef\u5728\u60a8\u7684\u9879\u76ee\u4e2d\u4f7f\u7528\u3002<\/p>\n<ol>\n<li>\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684\u5e94\u7528\u7a0b\u5e8f<\/li>\n<\/ol>\n<p>\u4ee5\u4e0b\u662f\u5982\u4f55\u4f7f\u7528 bottle \u521b\u5efa\u57fa\u672c web \u5e94\u7528\u7a0b\u5e8f\uff1a<\/p>\n<p>\u4ece\u74f6\u5b50\u5bfc\u5165\u74f6\u5b50\uff0c\u8fd0\u884c<\/p>\n<p>app = bottle()<\/p>\n<p>@app.route(&#8216;\/hello&#8217;)<br \/> def hello():<br \/> \u8fd4\u56de\u201c\u4f60\u597d\uff0c\u4e16\u754c\uff01\u201d<\/p>\n<p>\u8fd0\u884c\uff08\u5e94\u7528\u7a0b\u5e8f\uff0c\u4e3b\u673a=&#8217;localhost&#8217;\uff0c\u7aef\u53e3=8080\uff09<\/p>\n<p>\u8bf4\u660e\uff1a<\/p>\n<p>bottle() \u521b\u5efa\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u5b9e\u4f8b\u3002\u8be5\u5b9e\u4f8b\u7528\u4e8e\u5b9a\u4e49\u8def\u7531\u548c\u5904\u7406\u8bf7\u6c42\u3002<\/p>\n<p>@app.route(&#8216;\/hello&#8217;) \u662f\u4e00\u4e2a\u5b9a\u4e49\u8def\u7531\u7684\u88c5\u9970\u5668\uff0c\u5c06 url \/hello \u6620\u5c04\u5230\u51fd\u6570 hello()\u3002\u6bcf\u5f53\u8bbf\u95ee\u6b64 url \u65f6\uff0c\u90fd\u4f1a\u8c03\u7528 hello() \u51fd\u6570\uff0c\u5e76\u8f93\u51fa\u5b57\u7b26\u4e32\u201chello, world!\u201d\u4f5c\u4e3a\u54cd\u5e94\u8fd4\u56de\u3002<\/p>\n<p>run(app, host=&#8217;localhost&#8217;, port=8080) \u542f\u52a8\u5185\u7f6e web \u670d\u52a1\u5668\uff0c\u4f7f\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u53ef\u4ee5\u901a\u8fc7 http:\/\/localhost:8080\/hello \u8bbf\u95ee\u3002<\/p>\n<ol>\n<li>\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f<\/li>\n<\/ol>\n<p>\u8981\u8fd0\u884c\u4e0a\u9762\u7684\u793a\u4f8b\uff0c\u8bf7\u5c06\u4ee3\u7801\u4fdd\u5b58\u5230\u6587\u4ef6\u4e2d\uff0c\u4f8b\u5982 app.py\uff0c\u7136\u540e\u6267\u884c\u5b83\uff1a<\/p>\n<p>python app.py<\/p>\n<p>\u5728\u6d4f\u89c8\u5668\u4e2d\u5bfc\u822a\u5230 http:\/\/localhost:8080\/hello\uff0c\u60a8\u5e94\u8be5\u770b\u5230\u201chello, world!\u201d\u663e\u793a\u3002<\/p>\n<ol>\n<li>\u5173\u952e\u672f\u8bed<\/li>\n<\/ol>\n<p>\u7406\u89e3\u8fd9\u4e9b\u6838\u5fc3\u6982\u5ff5\u5c06\u5e2e\u52a9\u60a8\u4f7f\u7528 bottle \u6784\u5efa\u66f4\u590d\u6742\u7684\u5e94\u7528\u7a0b\u5e8f\uff1a<\/p>\n<p>4.1\u3002\u8def\u7ebf<\/p>\n<p>\u8def\u7531\u662f\u4e00\u79cd\u5b9a\u4e49\u5e94\u7528\u7a0b\u5e8f\u5e94\u5982\u4f55\u5904\u7406\u7279\u5b9a url \u7684\u65b9\u6cd5\u3002 bottle \u4f7f\u7528\u88c5\u9970\u5668\u5c06 url \u6620\u5c04\u5230 python \u51fd\u6570\u3002<\/p>\n<p>\u4f8b\u5982\uff1a<\/p>\n<p>@app.route(&#8216;\/hello\/&#8217;)<br \/> def \u95ee\u5019\uff08\u540d\u5b57\uff09\uff1a<br \/> return f\u201c\u4f60\u597d\uff0c{name}\uff01\u201d<\/p>\n<p>\u8fd9\u91cc\u662f\u4e00\u4e2a\u52a8\u6001\u6bb5\uff0c\u8fd9\u610f\u5473\u7740\u5982\u679c\u60a8\u8bbf\u95eehttp:\/\/localhost:8080\/hello\/john\uff0c\u8f93\u51fa\u5c06\u662f\u201chello, john!\u201d\u3002<\/p>\n<p>4.2\u3002\u8bf7\u6c42\u548c\u54cd\u5e94<\/p>\n<p>request\uff1a\u8bf7\u6c42\u5bf9\u8c61\u5305\u542b\u670d\u52a1\u5668\u63a5\u6536\u5230\u7684http\u8bf7\u6c42\u7684\u4fe1\u606f\uff0c\u4f8b\u5982\u6807\u5934\u3001\u67e5\u8be2\u53c2\u6570\u3001\u8868\u5355\u6570\u636e\u7b49<\/p>\n<p>\u6765\u81ea\u74f6\u5b50\u8fdb\u53e3\u8bf7\u6c42<\/p>\n<p>@app.route(&#8216;\/login&#8217;, method=&#8217;post&#8217;)<br \/> def \u767b\u5f55():<br \/> username = request.forms.get(&#8216;\u7528\u6237\u540d&#8217;)<br \/> \u5bc6\u7801 = request.forms.get(&#8216;\u5bc6\u7801&#8217;)<br \/> return f&#8221;\u7528\u6237\u540d\uff1a{\u7528\u6237\u540d}\uff0c\u5bc6\u7801\uff1a{\u5bc6\u7801}&#8221;<\/p>\n<p>\u6b64\u793a\u4f8b\u6f14\u793a\u5982\u4f55\u63d0\u53d6\u901a\u8fc7 post \u8bf7\u6c42\u53d1\u9001\u7684\u8868\u5355\u6570\u636e\u3002<\/p>\n<p>\u54cd\u5e94\uff1a\u94fe\u63a5\u5230\u8def\u7531\u7684\u51fd\u6570\u53ef\u4ee5\u8fd4\u56de\u5b57\u7b26\u4e32\uff08html\uff09\u3001json\u6216\u5176\u4ed6\u54cd\u5e94\u5bf9\u8c61\u3002 bottle \u5141\u8bb8\u60a8\u8bbe\u7f6e\u6807\u5934\u3001\u72b6\u6001\u4ee3\u7801\u7b49\u3002<\/p>\n<p>\u6765\u81ea\u74f6\u5b50\u5bfc\u5165\u54cd\u5e94<\/p>\n<p>@app.route(&#8216;\/json&#8217;)<br \/> def json_example():<br \/> response.content_type = &#8216;application\/json&#8217;<br \/> return &#8216;{&#8220;name&#8221;: &#8220;john&#8221;, &#8220;age&#8221;: 30}&#8217;<\/p>\n<p>4.3\u3002\u6a21\u677f<\/p>\n<p>\u6a21\u677f\u5141\u8bb8\u60a8\u5c06 html \u5185\u5bb9\u4e0e\u5e94\u7528\u7a0b\u5e8f\u7684\u903b\u8f91\u5206\u5f00\u3002 bottle \u5305\u542b\u4e00\u4e2a\u57fa\u672c\u6a21\u677f\u5f15\u64ce\uff0c\u4f7f\u8fd9\u4e00\u5207\u53d8\u5f97\u7b80\u5355\uff1a<\/p>\n<p>\u4ece\u74f6\u5b50\u5bfc\u5165\u6a21\u677f<\/p>\n<p>@app.route(&#8216;\/hello\/&#8217;)<br \/> def \u4f60\u597d\uff08\u540d\u5b57\uff09\uff1a<br \/> return template(&#8216;<b>hello {{name}}<\/b>!&#8217;, name=name)<\/p>\n<p>template() \u6e32\u67d3\u4e00\u4e2a\u6a21\u677f\u5b57\u7b26\u4e32\uff0c\u66ff\u6362 name \u7684\u503c\u3002<\/p>\n<p>\u60a8\u8fd8\u53ef\u4ee5\u4f7f\u7528\u5916\u90e8\u6a21\u677f\u6587\u4ef6\uff1a<\/p>\n<p><b>\u4f60\u597d{{name}}<\/b>\uff01<\/p>\n<p>@app.route(&#8216;\/hello\/&#8217;)<br \/> def \u4f60\u597d\uff08\u540d\u5b57\uff09\uff1a<br \/> return template(&#8216;hello&#8217;, name=name)<\/p>\n<p>4.4\u3002\u9759\u6001\u6587\u4ef6<\/p>\n<p>bottle \u53ef\u4ee5\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u63d0\u4f9b\u9759\u6001\u6587\u4ef6\uff0c\u4f8b\u5982 css\u3001javascript \u6216\u56fe\u50cf\uff1a<\/p>\n<p>\u4ece\u74f6\u5b50\u5bfc\u5165\u9759\u6001\u6587\u4ef6<\/p>\n<p>@app.route(&#8216;\/static\/&#8217;)<br \/> defserve_static(\u6587\u4ef6\u540d):<br \/> return static_file(\u6587\u4ef6\u540d, root=&#8217;\/path\/to\/static\/files&#8217;)<\/p>\n<p>\u5c06 &#8216;\/path\/to\/static\/files&#8217; \u66ff\u6362\u4e3a\u5b58\u50a8\u9759\u6001\u6587\u4ef6\u7684\u76ee\u5f55\u3002<\/p>\n<p>4.5\u3002\u63d2\u4ef6<\/p>\n<p>bottle \u5141\u8bb8\u60a8\u4f7f\u7528\u63d2\u4ef6\u6269\u5c55\u529f\u80fd\u3002\u4f8b\u5982\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u6570\u636e\u5e93\u63d2\u4ef6\u8f7b\u677e\u5730\u5c06\u6570\u636e\u5e93\u4e0e\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u96c6\u6210\uff1a<\/p>\n<p>\u4ece bottle.ext \u5bfc\u5165 sqlite<\/p>\n<p>app.install(sqlite.plugin(dbfile=&#8217;\/path\/to\/database.db&#8217;))<\/p>\n<p>4.6\u3002\u9519\u8bef\u5904\u7406<\/p>\n<p>\u60a8\u53ef\u4ee5\u4f7f\u7528 bottle \u7684\u9519\u8bef\u5904\u7406\u529f\u80fd\u521b\u5efa\u81ea\u5b9a\u4e49\u9519\u8bef\u9875\u9762\uff1a<\/p>\n<p>@app.error(404)<br \/> def error404\uff08\u9519\u8bef\uff09\uff1a<br \/> return &#8216;\u62b1\u6b49\uff0c\u8be5\u9875\u9762\u4e0d\u5b58\u5728\uff01&#8217;<\/p>\n<p>4.7\u3002\u4e2d\u95f4\u4ef6<\/p>\n<p>bottle \u7b26\u5408 wsgi\uff0c\u8fd9\u610f\u5473\u7740\u60a8\u53ef\u4ee5\u4f7f\u7528\u4e2d\u95f4\u4ef6\u6765\u6dfb\u52a0\u529f\u80fd\uff0c\u4f8b\u5982\u65e5\u5fd7\u8bb0\u5f55\u3001\u8eab\u4efd\u9a8c\u8bc1\u7b49<\/p>\n<p>\u7b80\u5355\u4e2d\u95f4\u4ef6\u793a\u4f8b\uff1a<\/p>\n<p>simplemiddleware \u7c7b\uff1a<br \/> def <strong>init<\/strong>(self, app):<br \/> self.app = \u5e94\u7528\u7a0b\u5e8f<\/p>\n<pre>def __call__(self, environ, start_response):\n    print(\"Middleware: Received request\")\n    return self.app(environ, start_response)\n<\/pre>\n<p>app = simplemiddleware(app)<\/p>\n<ol>\n<li>\u6784\u5efa\u5b8c\u6574\u7684\u793a\u4f8b\u5e94\u7528\u7a0b\u5e8f<\/li>\n<\/ol>\n<p>\u8ba9\u6211\u4eec\u6784\u5efa\u4e00\u4e2a\u7ed3\u5408\u6211\u4eec\u6240\u6db5\u76d6\u7684\u6240\u6709\u5185\u5bb9\u7684\u793a\u4f8b\uff1a<\/p>\n<p>\u6765\u81ea bottle \u5bfc\u5165 bottle\u3001\u8fd0\u884c\u3001\u8bf7\u6c42\u3001\u6a21\u677f\u3001\u9759\u6001\u6587\u4ef6<\/p>\n<p>app = bottle()<\/p>\n<p>@app.route(&#8216;\/&#8217;)<br \/> def home():<br \/> \u8fd4\u56de\u6a21\u677f(&#8216;<\/p>\n<p>\u540d\u79f0\uff1a&#8217;) <\/p>\n<p>@app.route(&#8216;\/greet&#8217;, method=&#8217;post&#8217;)<br \/> def \u95ee\u5019\uff08\uff09\uff1a<br \/> name = request.forms.get(&#8216;name&#8217;)<br \/> return template(&#8216;\u4f60\u597d\uff0c{{name}}!&#8217;, name=name)<\/p>\n<p>@app.route(&#8216;\/static\/&#8217;)<br \/> defserve_static(\u6587\u4ef6\u540d):<br \/> return static_file(\u6587\u4ef6\u540d, root=&#8217;.\/static&#8217;)<\/p>\n<p>@app.error(404)<br \/> def error404\uff08\u9519\u8bef\uff09\uff1a<br \/> return &#8216;\u9875\u9762\u672a\u627e\u5230\u3002\u8bf7\u68c0\u67e5\u7f51\u5740\u3002&#8217;<\/p>\n<p>\u8fd0\u884c\uff08\u5e94\u7528\u7a0b\u5e8f\uff0c\u4e3b\u673a=&#8217;localhost&#8217;\uff0c\u7aef\u53e3=8080\uff09<\/p>\n<p>\u8bf4\u660e\uff1a<\/p>\n<p>\u4e3b\u9875\uff1a\u663e\u793a\u7528\u6237\u53ef\u4ee5\u8f93\u5165\u540d\u79f0\u7684\u8868\u5355\u3002<\/p>\n<p>\u95ee\u5019\u8bed\u8def\u7531\uff1a\u5904\u7406\u8868\u5355\u8f93\u5165\u5e76\u663e\u793a\u95ee\u5019\u8bed\u3002<\/p>\n<p>\u9759\u6001\u6587\u4ef6\uff1a\u6f14\u793a\u5982\u4f55\u63d0\u4f9b css\u3001js \u6216\u56fe\u50cf\u3002<\/p>\n<p>\u9519\u8bef\u5904\u7406\uff1a\u663e\u793a\u81ea\u5b9a\u4e49 404 \u9519\u8bef\u6d88\u606f\u3002<\/p>\n<ol>\n<li>\u4e3a\u4ec0\u4e48\u8981\u7528\u5976\u74f6\uff1f<\/li>\n<\/ol>\n<p>\u4f18\u70b9\uff1a<\/p>\n<p>\u8f7b\u91cf\u7ea7\uff1a\u53ea\u6709\u4e00\u4e2a\u6587\u4ef6\uff0c\u9664\u4e86python\u6807\u51c6\u5e93\u4e4b\u5916\u6ca1\u6709\u4efb\u4f55\u4f9d\u8d56\u9879\u3002<\/p>\n<p>\u7b80\u5355\uff1a\u6613\u4e8e\u5b66\u4e60\u548c\u4f7f\u7528\uff0c\u975e\u5e38\u9002\u5408\u5c0f\u578b\u9879\u76ee\u6216\u539f\u578b\u3002<\/p>\n<p>\u53ef\u6269\u5c55\uff1a\u652f\u6301\u63d2\u4ef6\u548c\u4e2d\u95f4\u4ef6\uff0c\u56e0\u6b64\u5b83\u53ef\u4ee5\u968f\u7740\u60a8\u7684\u9879\u76ee\u4e00\u8d77\u6210\u957f\u3002<\/p>\n<p>\u7528\u4f8b\uff1a<\/p>\n<p>\u6784\u5efa api \u6216\u5fae\u670d\u52a1<\/p>\n<p>\u5feb\u901f\u539f\u578b\u5236\u4f5c<\/p>\n<p>\u4e2d\u5c0f\u578b web \u5e94\u7528\u7a0b\u5e8f<\/p>\n<p>\u5728\u57fa\u4e8e python \u7684\u5de5\u5177\u6216\u811a\u672c\u4e2d\u5d4c\u5165 web \u670d\u52a1\u5668<\/p>\n<p>\u7ed3\u8bba<\/p>\n<p>\u5bf9\u4e8e\u5e0c\u671b\u5feb\u901f\u6784\u5efa\u5c0f\u578b web \u5e94\u7528\u7a0b\u5e8f\u800c\u65e0\u9700\u8fdb\u884c\u592a\u591a\u8bbe\u7f6e\u7684\u5f00\u53d1\u4eba\u5458\u6765\u8bf4\uff0cbottle \u662f\u4e00\u4e2a\u7edd\u4f73\u7684\u9009\u62e9\u3002\u4e86\u89e3\u8def\u7531\u3001\u6a21\u677f\u3001\u8bf7\u6c42\u548c\u54cd\u5e94\u7684\u5de5\u4f5c\u539f\u7406\u5c06\u4f7f\u60a8\u80fd\u591f\u521b\u5efa\u6709\u6548\u4e14\u9ad8\u6548\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\u4f7f\u7528\u6b63\u786e\u7684\u63d2\u4ef6\u548c\u4e2d\u95f4\u4ef6\uff0c\u60a8\u53ef\u4ee5\u6269\u5c55 bottle \u7684\u529f\u80fd\u4ee5\u9002\u5e94\u66f4\u590d\u6742\u7684\u7528\u4f8b\u3002<\/p>\n<p>\u5230\u8fd9\u91cc\uff0c\u6211\u4eec\u4e5f\u5c31\u8bb2\u5b8c\u4e86\u300aBottle &#8211; Python \u8f7b\u91cf\u7ea7\u5feb\u901f\u5fae\u578b Web \u6846\u67b6\u300b\u7684\u5185\u5bb9\u4e86\u3002\u4e2a\u4eba\u8ba4\u4e3a\uff0c\u57fa\u7840\u77e5\u8bc6\u7684\u5b66\u4e60\u548c\u5de9\u56fa\uff0c\u662f\u4e3a\u4e86\u66f4\u597d\u7684\u5c06\u5176\u8fd0\u7528\u5230\u9879\u76ee\u4e2d\uff0c\u6b22\u8fce\u5173\u6ce8\u516c\u4f17\u53f7\uff0c\u5e26\u4f60\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u77e5\u8bc6\u70b9\uff01<\/p>\n<p>      \u7248\u672c\u58f0\u660e \u672c\u6587\u8f6c\u8f7d\u4e8e\uff1adev.to \u5982\u6709\u4fb5\u72af\uff0c\u8bf7\u8054\u7cfb\u5220\u9664<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bottle &#8211; P&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-204258","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/204258","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=204258"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/204258\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=204258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=204258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=204258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}