{"id":964796,"date":"2024-12-27T04:31:50","date_gmt":"2024-12-26T20:31:50","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/964796.html"},"modified":"2024-12-27T04:31:53","modified_gmt":"2024-12-26T20:31:53","slug":"python%e5%a6%82%e4%bd%95%e7%94%9f%e6%88%90%e5%a4%9a%e4%b8%aa%e7%bd%91%e9%a1%b5","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/964796.html","title":{"rendered":"python\u5982\u4f55\u751f\u6210\u591a\u4e2a\u7f51\u9875"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24181411\/10a6f674-2ba3-4003-8e16-39aed6f72162.webp\" alt=\"python\u5982\u4f55\u751f\u6210\u591a\u4e2a\u7f51\u9875\" \/><\/p>\n<p><p> \u5f00\u5934\u6bb5\u843d\uff1a<br \/>Python\u751f\u6210\u591a\u4e2a\u7f51\u9875\u7684\u5e38\u7528\u65b9\u6cd5\u5305\u62ec<strong>\u4f7f\u7528Flask\u6846\u67b6\u3001\u5229\u7528Django\u6846\u67b6\u3001\u4f7f\u7528Jinja2\u6a21\u677f\u5f15\u64ce\u3001\u8fd0\u7528\u9759\u6001\u7f51\u7ad9\u751f\u6210\u5668\u5982Pelican<\/strong>\u3002\u5176\u4e2d\uff0c<strong>\u4f7f\u7528Flask\u6846\u67b6<\/strong>\u662f\u4e00\u4e2a\u975e\u5e38\u7075\u6d3b\u4e14\u7b80\u5355\u7684\u9009\u62e9\u3002Flask\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684Python Web\u6846\u67b6\uff0c\u5b83\u5141\u8bb8\u5f00\u53d1\u8005\u5feb\u901f\u521b\u5efa\u548c\u90e8\u7f72\u5e94\u7528\u3002Flask\u7684URL\u8def\u7531\u7cfb\u7edf\u4f7f\u5f97\u521b\u5efa\u591a\u4e2a\u7f51\u9875\u53d8\u5f97\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u9700\u4e3a\u6bcf\u4e2a\u7f51\u9875\u5b9a\u4e49\u4e00\u4e2a\u89c6\u56fe\u51fd\u6570\u5e76\u6307\u5b9a\u5176\u8def\u7531\u5373\u53ef\u3002\u901a\u8fc7Flask\u6846\u67b6\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u8f7b\u677e\u7ba1\u7406\u590d\u6742\u7684\u591a\u9875\u9762\u7f51\u7ad9\uff0c\u751a\u81f3\u662f\u52a8\u6001\u7f51\u9875\u5e94\u7528\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u63a2\u8ba8\u8fd9\u4e9b\u65b9\u6cd5\u7684\u5e94\u7528\u548c\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><p>\u6b63\u6587\uff1a<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4f7f\u7528FLASK\u6846\u67b6<\/p>\n<\/p>\n<p><p>Flask\u662f\u4e00\u4e2a\u5fae\u578b\u6846\u67b6\uff0c\u9002\u5408\u4e8e\u5f00\u53d1\u5c0f\u578b\u5e94\u7528\u7a0b\u5e8f\u548c\u539f\u578b\u3002\u5b83\u63d0\u4f9b\u4e86\u7b80\u5355\u7684\u8def\u7531\u673a\u5236\u548c\u6a21\u677f\u6e32\u67d3\u529f\u80fd\uff0c\u53ef\u4ee5\u8f7b\u677e\u5730\u751f\u6210\u591a\u4e2a\u7f51\u9875\u3002<\/p>\n<\/p>\n<ol>\n<li>\u5b89\u88c5Flask<\/li>\n<\/ol>\n<p><p>\u8981\u4f7f\u7528Flask\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5\u5b83\u3002\u53ef\u4ee5\u901a\u8fc7pip\u5de5\u5177\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install flask<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u5c31\u53ef\u4ee5\u5f00\u59cb\u521b\u5efaFlask\u5e94\u7528\u3002<\/p>\n<\/p>\n<ol start=\"2\">\n<li>\u521b\u5efaFlask\u5e94\u7528<\/li>\n<\/ol>\n<p><p>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Python\u6587\u4ef6\uff0c\u6bd4\u5982app.py\uff0c\u5e76\u5199\u5165\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from flask import Flask, render_template<\/p>\n<p>app = Flask(__name__)<\/p>\n<p>@app.route(&#39;\/&#39;)<\/p>\n<p>def home():<\/p>\n<p>    return render_template(&#39;home.html&#39;)<\/p>\n<p>@app.route(&#39;\/about&#39;)<\/p>\n<p>def about():<\/p>\n<p>    return render_template(&#39;about.html&#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>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u5b9a\u4e49\u4e86\u4e24\u4e2a\u8def\u7531\uff1a<code>\/<\/code>\u548c<code>\/about<\/code>\uff0c\u5206\u522b\u5bf9\u5e94\u4e8ehome.html\u548cabout.html\u4e24\u4e2a\u6a21\u677f\u6587\u4ef6\u3002<\/p>\n<\/p>\n<ol start=\"3\">\n<li>\u521b\u5efaHTML\u6a21\u677f<\/li>\n<\/ol>\n<p><p>\u5728\u9879\u76ee\u6587\u4ef6\u5939\u4e2d\u521b\u5efa\u4e00\u4e2a\u540d\u4e3atemplates\u7684\u76ee\u5f55\uff0c\u7136\u540e\u5728\u8be5\u76ee\u5f55\u4e0b\u521b\u5efahome.html\u548cabout.html\u6587\u4ef6\u3002\u8fd9\u4e9b\u6587\u4ef6\u5c06\u662f\u4f60\u7684\u7f51\u7ad9\u9875\u9762\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-html\">&lt;!-- home.html --&gt;<\/p>\n<p>&lt;!DOCTYPE html&gt;<\/p>\n<p>&lt;html&gt;<\/p>\n<p>&lt;head&gt;<\/p>\n<p>    &lt;title&gt;Home Page&lt;\/title&gt;<\/p>\n<p>&lt;\/head&gt;<\/p>\n<p>&lt;body&gt;<\/p>\n<p>    &lt;h1&gt;Welcome to the Home Page&lt;\/h1&gt;<\/p>\n<p>&lt;\/body&gt;<\/p>\n<p>&lt;\/html&gt;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><pre><code class=\"language-html\">&lt;!-- about.html --&gt;<\/p>\n<p>&lt;!DOCTYPE html&gt;<\/p>\n<p>&lt;html&gt;<\/p>\n<p>&lt;head&gt;<\/p>\n<p>    &lt;title&gt;About Page&lt;\/title&gt;<\/p>\n<p>&lt;\/head&gt;<\/p>\n<p>&lt;body&gt;<\/p>\n<p>    &lt;h1&gt;About Us&lt;\/h1&gt;<\/p>\n<p>    &lt;p&gt;This is the about page.&lt;\/p&gt;<\/p>\n<p>&lt;\/body&gt;<\/p>\n<p>&lt;\/html&gt;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u8fd9\u4e2a\u7b80\u5355\u7684\u8bbe\u7f6e\uff0c\u4f60\u5df2\u7ecf\u521b\u5efa\u4e86\u4e00\u4e2a\u5305\u542b\u591a\u4e2a\u7f51\u9875\u7684\u57fa\u672cFlask\u5e94\u7528\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u5229\u7528DJANGO\u6846\u67b6<\/p>\n<\/p>\n<p><p>Django\u662f\u4e00\u4e2a\u529f\u80fd\u9f50\u5168\u7684Web\u6846\u67b6\uff0c\u9002\u5408\u4e8e\u5f00\u53d1\u590d\u6742\u7684\u3001\u6570\u636e\u9a71\u52a8\u7684\u7f51\u7ad9\u3002\u5b83\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u529f\u80fd\u548c\u5de5\u5177\uff0c\u53ef\u4ee5\u8f7b\u677e\u751f\u6210\u591a\u4e2a\u7f51\u9875\u3002<\/p>\n<\/p>\n<ol>\n<li>\u5b89\u88c5Django<\/li>\n<\/ol>\n<p><p>\u9996\u5148\u9700\u8981\u5b89\u88c5Django\uff0c\u540c\u6837\u53ef\u4ee5\u901a\u8fc7pip\u5de5\u5177\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install django<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u521b\u5efaDjango\u9879\u76ee<\/li>\n<\/ol>\n<p><p>\u4f7f\u7528Django\u547d\u4ee4\u884c\u5de5\u5177\u521b\u5efa\u4e00\u4e2a\u65b0\u9879\u76ee\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">django-admin startproject mysite<\/p>\n<p>cd mysite<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"3\">\n<li>\u521b\u5efa\u5e94\u7528<\/li>\n<\/ol>\n<p><p>\u5728Django\u9879\u76ee\u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5e94\u7528\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python manage.py startapp myapp<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"4\">\n<li>\u5b9a\u4e49\u89c6\u56fe\u548cURL<\/li>\n<\/ol>\n<p><p>\u5728myapp\/views.py\u4e2d\u5b9a\u4e49\u89c6\u56fe\u51fd\u6570\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from django.shortcuts import render<\/p>\n<p>def home(request):<\/p>\n<p>    return render(request, &#39;home.html&#39;)<\/p>\n<p>def about(request):<\/p>\n<p>    return render(request, &#39;about.html&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728mysite\/urls.py\u4e2d\u914d\u7f6eURL\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from django.contrib import admin<\/p>\n<p>from django.urls import path<\/p>\n<p>from myapp import views<\/p>\n<p>urlpatterns = [<\/p>\n<p>    path(&#39;admin\/&#39;, admin.site.urls),<\/p>\n<p>    path(&#39;&#39;, views.home, name=&#39;home&#39;),<\/p>\n<p>    path(&#39;about\/&#39;, views.about, name=&#39;about&#39;),<\/p>\n<p>]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"5\">\n<li>\u521b\u5efaHTML\u6a21\u677f<\/li>\n<\/ol>\n<p><p>\u5728myapp\/templates\u76ee\u5f55\u4e0b\u521b\u5efahome.html\u548cabout.html\u6587\u4ef6\uff0c\u5185\u5bb9\u53ef\u4ee5\u53c2\u8003Flask\u793a\u4f8b\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7Django\u6846\u67b6\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u8f7b\u677e\u7ba1\u7406\u590d\u6742\u7684\u591a\u9875\u9762\u7f51\u7ad9\uff0c\u5e76\u63d0\u4f9b\u5f3a\u5927\u7684\u540e\u53f0\u7ba1\u7406\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><p>\u4e09\u3001\u4f7f\u7528JINJA2\u6a21\u677f\u5f15\u64ce<\/p>\n<\/p>\n<p><p>Jinja2\u662f\u4e00\u4e2a\u73b0\u4ee3\u548c\u8bbe\u8ba1\u53cb\u597d\u7684Python\u6a21\u677f\u5f15\u64ce\u3002\u5b83\u53ef\u4ee5\u4e0eFlask\u6216\u5176\u4ed6\u6846\u67b6\u7ed3\u5408\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u72ec\u7acb\u4f7f\u7528\u6765\u751f\u6210\u9759\u6001\u7f51\u9875\u3002<\/p>\n<\/p>\n<ol>\n<li>\u5b89\u88c5Jinja2<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">pip install Jinja2<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u521b\u5efa\u6a21\u677f\u548c\u6e32\u67d3<\/li>\n<\/ol>\n<p><p>\u521b\u5efa\u4e00\u4e2aPython\u6587\u4ef6\uff0c\u5e76\u4f7f\u7528Jinja2\u6e32\u67d3\u6a21\u677f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from jinja2 import Environment, FileSystemLoader<\/p>\n<p>env = Environment(loader=FileSystemLoader(&#39;templates&#39;))<\/p>\n<p>template = env.get_template(&#39;home.html&#39;)<\/p>\n<p>output = template.render(title=&#39;Home Page&#39;, content=&#39;Welcome to the Home Page&#39;)<\/p>\n<p>print(output)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728templates\u76ee\u5f55\u4e2d\u521b\u5efahome.html\u6a21\u677f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-html\">&lt;!DOCTYPE html&gt;<\/p>\n<p>&lt;html&gt;<\/p>\n<p>&lt;head&gt;<\/p>\n<p>    &lt;title&gt;{{ title }}&lt;\/title&gt;<\/p>\n<p>&lt;\/head&gt;<\/p>\n<p>&lt;body&gt;<\/p>\n<p>    &lt;h1&gt;{{ content }}&lt;\/h1&gt;<\/p>\n<p>&lt;\/body&gt;<\/p>\n<p>&lt;\/html&gt;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u79cd\u65b9\u5f0f\u9002\u5408\u4e8e\u751f\u6210\u9759\u6001\u7f51\u9875\u6587\u4ef6\uff0c\u53ef\u4ee5\u5c06\u8f93\u51fa\u4fdd\u5b58\u4e3aHTML\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001\u8fd0\u7528\u9759\u6001\u7f51\u7ad9\u751f\u6210\u5668\u5982PELICAN<\/p>\n<\/p>\n<p><p>\u9759\u6001\u7f51\u7ad9\u751f\u6210\u5668\u662f\u4e00\u79cd\u5c06\u5185\u5bb9\u548c\u6a21\u677f\u7ed3\u5408\u751f\u6210\u9759\u6001HTML\u6587\u4ef6\u7684\u5de5\u5177\u3002Pelican\u662f\u4e00\u4e2a\u57fa\u4e8ePython\u7684\u9759\u6001\u7f51\u7ad9\u751f\u6210\u5668\u3002<\/p>\n<\/p>\n<ol>\n<li>\u5b89\u88c5Pelican<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">pip install pelican<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u521b\u5efa\u9879\u76ee<\/li>\n<\/ol>\n<p><p>\u4f7f\u7528Pelican\u521b\u5efa\u65b0\u9879\u76ee\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pelican-quickstart<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6309\u7167\u63d0\u793a\u8f93\u5165\u9879\u76ee\u540d\u79f0\u3001\u4f5c\u8005\u4fe1\u606f\u7b49\u3002<\/p>\n<\/p>\n<ol start=\"3\">\n<li>\u7f16\u5199\u5185\u5bb9<\/li>\n<\/ol>\n<p><p>\u5728\u5185\u5bb9\u76ee\u5f55\u4e2d\u521b\u5efaMarkdown\u6587\u4ef6\uff0c\u5982content\/pages\/home.md\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-markdown\">Title: Home Page<\/p>\n<p>Date: 2023-10-01<\/p>\n<p>Welcome to the Home Page.<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"4\">\n<li>\u751f\u6210\u9759\u6001\u7f51\u7ad9<\/li>\n<\/ol>\n<p><p>\u8fd0\u884cPelican\u751f\u6210\u9759\u6001\u7f51\u7ad9\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pelican content<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u751f\u6210\u7684HTML\u6587\u4ef6\u5c06\u4f4d\u4e8eoutput\u76ee\u5f55\u4e2d\uff0c\u53ef\u4ee5\u76f4\u63a5\u90e8\u7f72\u5230Web\u670d\u52a1\u5668\u4e0a\u3002<\/p>\n<\/p>\n<p><p>\u4e94\u3001\u603b\u7ed3\u4e0e\u5efa\u8bae<\/p>\n<\/p>\n<p><p>Python\u63d0\u4f9b\u4e86\u591a\u79cd\u5de5\u5177\u548c\u6846\u67b6\u6765\u751f\u6210\u591a\u4e2a\u7f51\u9875\uff0c\u4ece\u8f7b\u91cf\u7ea7\u7684Flask\u5230\u529f\u80fd\u9f50\u5168\u7684Django\uff0c\u518d\u5230\u9759\u6001\u7f51\u7ad9\u751f\u6210\u5668Pelican\uff0c\u6bcf\u79cd\u65b9\u6cd5\u90fd\u6709\u5176\u72ec\u7279\u7684\u4f18\u52bf\u548c\u9002\u7528\u573a\u666f\u3002<\/p>\n<\/p>\n<ul>\n<li><strong>\u5bf9\u4e8e\u7b80\u5355\u7684\u591a\u9875\u9762\u7f51\u7ad9\uff0cFlask\u662f\u4e00\u4e2a\u4e0d\u9519\u7684\u9009\u62e9<\/strong>\uff0c\u5b83\u6613\u4e8e\u4f7f\u7528\u4e14\u7075\u6d3b\u3002<\/li>\n<li><strong>\u5bf9\u4e8e\u590d\u6742\u7684\u5e94\u7528\u7a0b\u5e8f\uff0cDjango\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u529f\u80fd\u548c\u53ef\u6269\u5c55\u6027<\/strong>\u3002<\/li>\n<li><strong>\u5982\u679c\u9700\u8981\u751f\u6210\u9759\u6001\u7f51\u7ad9\uff0cPelican\u662f\u4e00\u4e2a\u9ad8\u6548\u7684\u5de5\u5177<\/strong>\uff0c\u7279\u522b\u9002\u5408\u535a\u5ba2\u6216\u6587\u6863\u7f51\u7ad9\u3002<\/li>\n<\/ul>\n<p><p>\u5728\u9009\u62e9\u5de5\u5177\u65f6\uff0c\u5f00\u53d1\u8005\u9700\u8981\u6839\u636e\u9879\u76ee\u7684\u5177\u4f53\u9700\u6c42\u3001\u590d\u6742\u6027\u548c\u672a\u6765\u7684\u53ef\u6269\u5c55\u6027\u6765\u505a\u51fa\u51b3\u7b56\u3002\u65e0\u8bba\u9009\u62e9\u54ea\u79cd\u5de5\u5177\uff0cPython\u4e30\u5bcc\u7684\u751f\u6001\u7cfb\u7edf\u90fd\u80fd\u4e3a\u7f51\u7ad9\u5f00\u53d1\u63d0\u4f9b\u5f3a\u6709\u529b\u7684\u652f\u6301\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u4f7f\u7528Python\u751f\u6210\u9759\u6001\u7f51\u9875\uff1f<\/strong><br \/>Python\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u751f\u6210\u9759\u6001\u7f51\u9875\u3002\u4f8b\u5982\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528Flask\u6216Django\u7b49\u6846\u67b6\uff0c\u8fd9\u4e9b\u6846\u67b6\u652f\u6301\u6a21\u677f\u5f15\u64ce\uff0c\u5141\u8bb8\u60a8\u52a8\u6001\u751f\u6210HTML\u6587\u4ef6\u3002\u6b64\u5916\uff0c\u60a8\u8fd8\u53ef\u4ee5\u4f7f\u7528\u7b80\u5355\u7684\u6587\u4ef6\u64cd\u4f5c\uff0c\u5c06HTML\u4ee3\u7801\u5199\u5165\u6587\u4ef6\u4e2d\u3002\u4f7f\u7528\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u60a8\u53ef\u4ee5\u521b\u5efa\u591a\u4e2a\u7f51\u9875\uff0c\u5e76\u6839\u636e\u9700\u8981\u8fdb\u884c\u4fee\u6539\u548c\u6269\u5c55\u3002<\/p>\n<p><strong>\u53ef\u4ee5\u4f7f\u7528\u54ea\u4e9bPython\u5e93\u6765\u751f\u6210\u7f51\u9875\u5185\u5bb9\uff1f<\/strong><br \/>\u6709\u5f88\u591aPython\u5e93\u53ef\u4ee5\u5e2e\u52a9\u60a8\u751f\u6210\u7f51\u9875\u5185\u5bb9\u3002\u5e38\u7528\u7684\u5e93\u5305\u62ecFlask\u548cDjango\uff0c\u5b83\u4eec\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u8def\u7531\u548c\u6a21\u677f\u529f\u80fd\u3002\u6b64\u5916\uff0cJinja2\u662f\u4e00\u4e2a\u6d41\u884c\u7684\u6a21\u677f\u5f15\u64ce\uff0c\u53ef\u4ee5\u4e0eFlask\u914d\u5408\u4f7f\u7528\uff0c\u5e2e\u52a9\u60a8\u52a8\u6001\u751f\u6210HTML\u9875\u9762\u3002\u8fd8\u6709BeautifulSoup\uff0c\u5b83\u4e3b\u8981\u7528\u4e8e\u89e3\u6790\u548c\u5904\u7406\u7f51\u9875\u5185\u5bb9\uff0c\u9002\u5408\u9700\u8981\u6293\u53d6\u548c\u5206\u6790\u7f51\u9875\u7684\u60c5\u51b5\u3002<\/p>\n<p><strong>\u5982\u4f55\u5c06\u751f\u6210\u7684\u7f51\u9875\u90e8\u7f72\u5230\u670d\u52a1\u5668\u4e0a\uff1f<\/strong><br \/>\u5c06\u751f\u6210\u7684\u7f51\u9875\u90e8\u7f72\u5230\u670d\u52a1\u5668\u4e0a\u901a\u5e38\u9700\u8981\u4f7f\u7528Web\u670d\u52a1\u5668\u8f6f\u4ef6\uff0c\u5982Nginx\u6216Apache\u3002\u60a8\u53ef\u4ee5\u5c06\u751f\u6210\u7684HTML\u6587\u4ef6\u4e0a\u4f20\u5230\u670d\u52a1\u5668\u4e0a\u7684\u6307\u5b9a\u76ee\u5f55\uff0c\u5e76\u914d\u7f6e\u76f8\u5e94\u7684\u670d\u52a1\u5668\u8bbe\u7f6e\uff0c\u4f7f\u5176\u80fd\u591f\u6b63\u786e\u5730\u63d0\u4f9b\u7f51\u9875\u3002\u6b64\u5916\uff0c\u4f7f\u7528Flask\u6216Django\u7b49\u6846\u67b6\uff0c\u60a8\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7\u5b83\u4eec\u7684\u5185\u5efa\u670d\u52a1\u5668\u8fdb\u884c\u6d4b\u8bd5\uff0c\u4e4b\u540e\u518d\u5c06\u5176\u90e8\u7f72\u5230\u66f4\u5177\u751f\u4ea7\u529b\u7684\u670d\u52a1\u5668\u4e0a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5f00\u5934\u6bb5\u843d\uff1aPython\u751f\u6210\u591a\u4e2a\u7f51\u9875\u7684\u5e38\u7528\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528Flask\u6846\u67b6\u3001\u5229\u7528Django\u6846\u67b6\u3001\u4f7f\u7528Jinja2\u6a21\u677f [&hellip;]","protected":false},"author":3,"featured_media":964800,"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\/964796"}],"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=964796"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/964796\/revisions"}],"predecessor-version":[{"id":964802,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/964796\/revisions\/964802"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/964800"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=964796"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=964796"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=964796"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}