{"id":6423,"date":"2021-05-11T19:05:00","date_gmt":"2021-05-11T11:05:00","guid":{"rendered":"https:\/\/vip.fxxkpython.com\/?p=6423"},"modified":"2021-05-12T19:20:13","modified_gmt":"2021-05-12T11:20:13","slug":"%e4%bd%bf%e7%94%a8-python-%e4%bb%8e-0-%e5%bc%80%e5%8f%91%e5%b1%9e%e4%ba%8e%e4%bd%a0%e7%9a%84%e4%b8%aa%e4%ba%ba%e7%ae%a1%e7%90%86%e7%b3%bb%e7%bb%9f-11-%e7%af%87-%ef%bd%9c-%e9%9c%80%e8%a6%81%e5%a4%84","status":"publish","type":"post","link":"https:\/\/vip.fxxkpython.com\/?p=6423","title":{"rendered":"\u4f7f\u7528 Python \u4ece 0 \u5f00\u53d1\u5c5e\u4e8e\u4f60\u7684\u4e2a\u4eba\u7ba1\u7406\u7cfb\u7edf 11 \u7bc7 \uff5c \u9700\u8981\u5904\u7406\u5404\u79cd\u8868\u5355\u8bf7\u6c42\uff1f\u4f7f\u7528 wtf \u641e\u5b9a"},"content":{"rendered":"\n<p>\u6211\u4eec\u5728\u5199 web \u7f51\u7ad9\u7684\u65f6\u5019\uff0c\u5e38\u5e38\u4f1a\u4f7f\u7528\u5230\u5404\u79cd\u8868\u5355\u7684\u8bf7\u6c42\u5904\u7406\uff0c\u6bd4\u5982\u7528\u6237\u540d\u5bc6\u7801\u7684\u63d0\u4ea4\u68c0\u9a8c\uff0c\u6587\u4ef6\u7684\u63d0\u4ea4\uff0c\u683c\u5f0f\u7684\u9a8c\u8bc1\u7b49\u7b49\u3002<\/p>\n\n\n\n<p>\u4f60\u53ef\u4ee5\u5c06\u4e0a\u6b21\u4e0b\u8f7d\u7684\u6a21\u677f\u6587\u4ef6\u4e2d\u7684 login.html \u653e\u5230 templates \u4e2d\uff0c\u6e32\u67d3\u4e00\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"450\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0a\u534812.22.41-1024x450.png\" alt=\"\" class=\"wp-image-6424\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0a\u534812.22.41-1024x450.png 1024w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0a\u534812.22.41-300x132.png 300w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0a\u534812.22.41-768x337.png 768w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0a\u534812.22.41-1536x674.png 1536w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0a\u534812.22.41-2048x899.png 2048w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0a\u534812.22.41-769x338.png 769w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u5728\u8fd9\u91cc\u7684 HTML \u4e2d\uff0c\u4f7f\u7528\u4e86 form \u6807\u7b7e\u6765\u4f7f\u7528\u8868\u5355\uff1a<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;wpum_restrict_type&quot;:&quot;wpum_restrict_type_state&quot;,&quot;wpum_hide_state_in&quot;:false,&quot;wpum_hide_state_out&quot;:false,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">&lt;form class=&quot;user&quot;&gt;\n           &lt;div class=&quot;form-group&quot;&gt;\n           &lt;input type=&quot;email&quot; class=&quot;form-control form-control-user&quot;\n                   id=&quot;exampleInputEmail&quot; aria-describedby=&quot;emailHelp&quot;\n                    placeholder=&quot;Enter Email Address...&quot;&gt;\n           &lt;\/div&gt;\n               &lt;div class=&quot;form-group&quot;&gt;\n                   &lt;input type=&quot;password&quot; class=&quot;form-control form-control-user&quot;\n                          id=&quot;exampleInputPassword&quot; placeholder=&quot;Password&quot;&gt;\n               &lt;\/div&gt;\n            &lt;div class=&quot;form-group&quot;&gt;\n                &lt;div class=&quot;custom-control custom-checkbox small&quot;&gt;\n               \t \t&lt;input type=&quot;checkbox&quot; class=&quot;custom-control-input&quot; id=&quot;customCheck&quot;&gt;\n                \t&lt;label class=&quot;custom-control-label&quot; for=&quot;customCheck&quot;&gt;Remember\n                       Me&lt;\/label&gt;\n                 &lt;\/div&gt;\n             &lt;\/div&gt;\n                  &lt;a href=&quot;index.html&quot; class=&quot;btn btn-primary btn-user btn-block&quot;&gt;\n                                            Login\n                  &lt;\/a&gt;\n&lt;\/form&gt;<\/pre><\/div>\n\n\n\n<p>\u5176\u4e2d\u7528\u5230\u4e86 input \u6807\u7b7e\u7684\u4e0d\u540c type \u6765\u63a5\u6536\u4e0d\u901a\u7684\u6570\u636e\u2014\u2014\u7528\u6237\u540d\uff0c\u5bc6\u7801\uff0c\u8bb0\u4f4f\u5bc6\u7801\uff0c\u767b\u5f55\u63d0\u4ea4\u3002<\/p>\n\n\n\n<p>\u4e8b\u5b9e\u4e0a\uff0c\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u5728 Python \u4e2d\u7ed3\u5408 WTF \u6765\u58f0\u660e\u8868\u5355\u7684\u7c7b\u578b\uff0c\u5e76\u4e14\u76f4\u63a5\u751f\u6210\uff0c\u4e0d\u9700\u8981\u6211\u4eec\u53bb\u5199\u76f8\u5e94\u7684 HTML\u3002<\/p>\n\n\n\n<h2>\u5b89\u88c5 WTF<\/h2>\n\n\n\n<p>WTF \u4e0d\u662f what the fuck\uff0c\u800c\u662f <a href=\"https:\/\/wtforms.readthedocs.io\/en\/2.3.x\/forms\/\">WTForm<\/a>\uff0c\u5b83\u63d0\u4f9b\u4e86 form \u8868\u5355\u6240\u6709\u7684\u7c7b\u578b\u751f\u6210\u4ee5\u53ca\u6570\u636e\u9a8c\u8bc1\u3002<\/p>\n\n\n\n<p>\u4f60\u53ef\u4ee5\u5728\u8fd9\u91cc\u627e\u5230\u6240\u6709 Form \u7684\u7c7b\u578b\u4f7f\u7528\uff1a<a href=\"https:\/\/wtforms.readthedocs.io\/en\/2.3.x\/fields\/#basic-fields\">https:\/\/wtforms.readthedocs.io\/en\/2.3.x\/fields\/#basic-fields<\/a><\/p>\n\n\n\n<p>\u5148\u8fdb\u5165\u865a\u62df\u73af\u5883\u5b89\u88c5\u4e00\u6ce2\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>pipenv shell<\/p><p>pipenv install flask-wtf<\/p><\/blockquote>\n\n\n\n<h2>\u4f7f\u7528 WTF<\/h2>\n\n\n\n<p>\u5b89\u88c5\u5b8c\u6210\u4e4b\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u4e0a\u9762\u7684\u767b\u5f55\u8868\u5355\uff0c\u7528 WTF \u7684\u5f62\u5f0f\u6765\u751f\u6210\u3002<\/p>\n\n\n\n<p>\u6211\u4eec\u5b9a\u4e00\u4e2a\u767b\u5f55\u8868\u5355\u7c7b\uff0c\u5728\u91cc\u9762\u5b9a\u4e49\u6211\u4eec\u9700\u8981\u7528\u5230\u7684\u5b57\u6bb5\uff1a\u7528\u6237\u540d\uff0c\u5bc6\u7801\uff0c\u662f\u5426\u8bb0\u4f4f\u5bc6\u7801\uff0c\u767b\u5f55\u63d0\u4ea4\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u7528\u6237\u540d\u7528\u5230\u4e86 StringField<\/p><p>\u5bc6\u7801\u7528\u5230\u4e86 PasswordField<\/p><p>\u662f\u5426\u8bb0\u4f4f\u5bc6\u7801\uff0c\u5355\u9009\u6846\u7528\u5230\u4e86 BooleanField<\/p><p>\u63d0\u4ea4\u7528\u5230\u4e86 SubmitField<\/p><\/blockquote>\n\n\n\n<p>\u8fdb\u5165 py \u6587\u4ef6\uff0c\u5bfc\u5165 FlaskForm \u4ee5\u53ca\u76f8\u5173\u5c5e\u6027\uff1a<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;wpum_restrict_type&quot;:&quot;wpum_restrict_type_state&quot;,&quot;wpum_hide_state_in&quot;:false,&quot;wpum_hide_state_out&quot;:false,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">from flask_wtf import FlaskForm\nfrom wtforms import StringField, PasswordField, \\\n    BooleanField, SubmitField<\/pre><\/div>\n\n\n\n<p>\u5728 init \u521d\u59cb\u5316\u65f6\u9700\u8981\u5b9a\u4e49\u4e00\u4e0b token\uff1a<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;wpum_restrict_type&quot;:&quot;wpum_restrict_type_state&quot;,&quot;wpum_hide_state_in&quot;:false,&quot;wpum_hide_state_out&quot;:false,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">from flask import Flask\n\napp = Flask('personal_system')\napp.secret_key = 'mysystem'<\/pre><\/div>\n\n\n\n<h2>\u521b\u5efa Form<\/h2>\n\n\n\n<p>\u73b0\u5728\u53ef\u4ee5\u521b\u5efa\u4f60\u7684 LoginForm class \u4e86\uff1a<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;wpum_restrict_type&quot;:&quot;wpum_restrict_type_state&quot;,&quot;wpum_hide_state_in&quot;:false,&quot;wpum_hide_state_out&quot;:false,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">class LoginForm(FlaskForm):\n \tusername = StringField('username')\n \tpassword = PasswordField('password')\n \tremember_pwd = BooleanField('remember_pwd')\n \tlogin = SubmitField('login')<\/pre><\/div>\n\n\n\n<p>\u53ef\u4ee5\u5b9a\u4e49 login \u65b9\u6cd5\uff0c\u751f\u6210 loginform \u5b9e\u4f8b\uff0c\u5148\u6253\u5370\u51fa\u6765\u770b\u770b\uff1a<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;wpum_restrict_type&quot;:&quot;wpum_restrict_type_state&quot;,&quot;wpum_hide_state_in&quot;:false,&quot;wpum_hide_state_out&quot;:false,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">@app.route('\/login', methods=['GET'])\ndef login():\n \tlogin_form = LoginForm()\n \tprint(login_form.username, sys.stdout)\n \treturn render_template('login.html')<\/pre><\/div>\n\n\n\n<p>\u5f53\u6211\u4eec\u8bbf\u95ee\u5730\u5740 <a href=\"http:\/\/127.0.0.1:8080\/login\">http:\/\/127.0.0.1:8080\/login<\/a> \u5c31\u4f1a\u8c03\u7528\u8fd9\u4e2a\u65b9\u6cd5\uff0c\u6253\u5370\u5f97\u5230\u7684\u7ed3\u679c\u662f\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>&lt;input id=&#8221;username&#8221; name=&#8221;username&#8221; type=&#8221;text&#8221; value=&#8221;&#8221;&gt;<\/p><\/blockquote>\n\n\n\n<p>\u770b\uff0cform \u7684\u76f8\u5173 HTML \u5df2\u7ecf\u751f\u6210\uff0c\u4e0d\u9700\u8981\u6211\u4eec\u5199\uff0c\u6211\u4eec\u53ea\u9700\u8981\u6e32\u67d3\u8fc7\u53bb\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n\n\n\n<h3>\u6e32\u67d3 Form<\/h3>\n\n\n\n<p>\u6709\u4e86 form \u6570\u636e\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u5c06\u5b83\u6e32\u67d3\u7ed9 HTML \uff0c\u5728\u8def\u7531\u65b9\u6cd5\u4e2d\u5c06\u6570\u636e\u7ed1\u5b9a\u8fc7\u53bb\uff1a<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;wpum_restrict_type&quot;:&quot;wpum_restrict_type_state&quot;,&quot;wpum_hide_state_in&quot;:false,&quot;wpum_hide_state_out&quot;:false,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">@app.route('\/login', methods=['GET'])\ndef login():\n \tlogin_form = LoginForm()\n \treturn render_template('login.html', form=login_form)<\/pre><\/div>\n\n\n\n<p>\u5728 HTML \u4e2d\uff0c\u6211\u4eec\u5c06 Form \u6e32\u67d3\u51fa\u6765\uff1a<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;wpum_restrict_type&quot;:&quot;wpum_restrict_type_state&quot;,&quot;wpum_hide_state_in&quot;:false,&quot;wpum_hide_state_out&quot;:false,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">&lt;form&gt;\n \t{{ form.username }}\n \t{{ form.password }}\n \t{{ form.remember_pwd }}\n \t{{ form.submit }}\n&lt;\/form&gt;<\/pre><\/div>\n\n\n\n<p>\u5f53\u6211\u4eec\u8fd0\u884c\u7684\u65f6\u5019\uff0c\u53ef\u4ee5\u770b\u4e00\u4e0b\u6e90\u7801\uff0c\u5728\u8fd9\u91cc\u6211\u4eec\u5f97\u5230\u7684 HTML \u5c31\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;wpum_restrict_type&quot;:&quot;wpum_restrict_type_state&quot;,&quot;wpum_hide_state_in&quot;:false,&quot;wpum_hide_state_out&quot;:false,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">&lt;form&gt;\n  &lt;input id=&quot;username&quot; name=&quot;username&quot; type=&quot;text&quot; value=&quot;&quot;&gt;\n  &lt;input id=&quot;password&quot; name=&quot;password&quot; type=&quot;password&quot; value=&quot;&quot;&gt;\n  &lt;input id=&quot;remember_pwd&quot; name=&quot;remember_pwd&quot; type=&quot;checkbox&quot; value=&quot;y&quot;&gt;\n  &lt;input id=&quot;login&quot; name=&quot;login&quot; type=&quot;submit&quot; value=&quot;login&quot;&gt;\n&lt;\/form&gt;<\/pre><\/div>\n\n\n\n<p>\u4f46\u662f\u76f4\u63a5\u8fd9\u6837\u751f\u6210\u6ca1\u6709\u6837\u5f0f\uff0c\u6709\u4ebf\u70b9\u4e11\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"336\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0b\u53485.49.39-1-1024x336.png\" alt=\"\" class=\"wp-image-6426\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0b\u53485.49.39-1-1024x336.png 1024w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0b\u53485.49.39-1-300x99.png 300w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0b\u53485.49.39-1-768x252.png 768w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0b\u53485.49.39-1-1536x505.png 1536w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0b\u53485.49.39-1-769x253.png 769w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0b\u53485.49.39-1.png 1912w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<h2>\u6837\u5f0f\u6dfb\u52a0<\/h2>\n\n\n\n<p>\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u5df2\u6709\u7684\u6837\u5f0f\uff0c\u5c06 class \u4e2d\u7684\u5185\u5bb9\u5e94\u7528\u5230\u6bcf\u4e2a\u751f\u6210\u7684 input \u6807\u7b7e\u4e2d\uff0c\u50cf\u8fd9\u6837\uff1a<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;wpum_restrict_type&quot;:&quot;wpum_restrict_type_state&quot;,&quot;wpum_hide_state_in&quot;:false,&quot;wpum_hide_state_out&quot;:false,&quot;language&quot;:&quot;Python&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;python&quot;}\">&lt;form class=&quot;user&quot;&gt;\n &lt;div class=&quot;form-group&quot;&gt;\n     {{ form.username(class=&quot;form-control form-control-user&quot;, placeholder=&quot;\u7528\u6237\u540d&quot;) }}\n &lt;\/div&gt;\n &lt;div class=&quot;form-group&quot;&gt;\n    {{ form.password(class=&quot;form-control form-control-user&quot;, placeholder=&quot;\u5bc6\u7801&quot;)}}\n &lt;\/div&gt;\n &lt;div class=&quot;form-group&quot;&gt;\n     &lt;div class=&quot;custom-control custom-checkbox small&quot;&gt;\n         &lt;input type=&quot;checkbox&quot; class=&quot;custom-control-input&quot; id=&quot;customCheck&quot;&gt;\n         {{ form.remember_pwd(class=&quot;custom-control-input&quot;) }}\n         {{ form.remember_pwd.label(class=&quot;custom-control-label&quot;) }}\n     &lt;\/div&gt;\n &lt;\/div&gt;\n {{ form.login(class=&quot;btn btn-primary btn-user btn-block&quot;) }}\n&lt;\/form&gt;<\/pre><\/div>\n\n\n\n<p>\u6bd4\u5982\u8fd9\u91cc\u6211\u4eec\u4f7f\u7528\u4e86\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>form.username(class=&#8221;form-control form-control-user&#8221;, placeholder=&#8221;\u7528\u6237\u540d&#8221;)<\/p><\/blockquote>\n\n\n\n<p>\u90a3\u4e48\u5c06\u4f1a\u751f\u6210\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>&lt;input class=&#8221;form-control form-control-user&#8221; id=&#8221;username&#8221; name=&#8221;username&#8221; placeholder=&#8221;\u7528\u6237\u540d&#8221; type=&#8221;text&#8221; value=&#8221;&#8221;&gt;<\/p><\/blockquote>\n\n\n\n<p>\u6211\u4eec\u73b0\u5728\u8fd0\u884c\u4e00\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"523\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0b\u53486.05.08-1024x523.png\" alt=\"\" class=\"wp-image-6427\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0b\u53486.05.08-1024x523.png 1024w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0b\u53486.05.08-300x153.png 300w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0b\u53486.05.08-768x393.png 768w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0b\u53486.05.08-1536x785.png 1536w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0b\u53486.05.08-769x393.png 769w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0b\u53486.05.08.png 1882w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u597d\u770b\u7684\u6837\u5f0f\u56de\u6765\u4e86\uff01<\/p>\n\n\n\n<h2>\u8868\u5355\u7684\u9a8c\u8bc1<\/h2>\n\n\n\n<p>\u53e6\u4e00\u4e2a\u5e38\u7528\u5230\u7684\u5730\u65b9\u5c31\u662f<div style=\"text-align:center;border:1px dashed #FF9A9A;padding:8px;margin:10px auto;color:#FF6666;\">\u672c\u6587\u9690\u85cf\u5185\u5bb9 <a href=\"https:\/\/vip.fxxkpython.com\/wp-login.php?redirect_to=https%3A%2F%2Fvip.fxxkpython.com%2F%3Fp%3D6423\">\u767b\u9646<\/a> \u540e\u624d\u53ef\u4ee5\u6d4f\u89c8<\/div>\u5f53\u9a8c\u8bc1\u901a\u8fc7\u65f6\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"511\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0b\u53487.01.10-1024x511.png\" alt=\"\" class=\"wp-image-6431\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0b\u53487.01.10-1024x511.png 1024w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0b\u53487.01.10-300x150.png 300w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0b\u53487.01.10-768x383.png 768w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0b\u53487.01.10-1536x766.png 1536w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0b\u53487.01.10-2048x1022.png 2048w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/05\/\u622a\u5c4f2021-05-12-\u4e0b\u53487.01.10-769x384.png 769w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>OK\uff0c\u4ee5\u4e0a\u5c31\u662f\u5173\u4e8e\u8868\u5355\u5e38\u7528\u7684\u64cd\u4f5c\uff0c\u90a3\u4e48\u6211\u4eec\u4e0b\u7bc7\u89c1\uff0cpeace\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6211\u4eec\u5728\u5199 web \u7f51\u7ad9\u7684\u65f6\u5019\uff0c\u5e38\u5e38\u4f1a\u4f7f\u7528\u5230\u5404\u79cd\u8868\u5355\u7684\u8bf7\u6c42\u5904\u7406\uff0c\u6bd4\u5982\u7528\u6237\u540d\u5bc6\u7801\u7684\u63d0\u4ea4\u68c0\u9a8c\uff0c\u6587\u4ef6\u7684\u63d0\u4ea4\uff0c\u683c\u5f0f\u7684\u9a8c\u8bc1\u7b49\u7b49\u3002 \u4f60\u53ef\u4ee5\u5c06\u4e0a\u6b21\u4e0b\u8f7d\u7684\u6a21\u677f\u6587\u4ef6\u4e2d\u7684 login.html \u653e\u5230 templates \u4e2d\uff0c\u6e32\u67d3\u4e00\u4e0b\uff1a \u5728\u8fd9\u91cc\u7684 HTML \u4e2d\uff0c\u4f7f\u7528\u4e86 fo&hellip;<\/p>\n","protected":false},"author":1,"featured_media":6430,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[99],"tags":[590,591,589],"_links":{"self":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/6423"}],"collection":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6423"}],"version-history":[{"count":1,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/6423\/revisions"}],"predecessor-version":[{"id":6432,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/6423\/revisions\/6432"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/media\/6430"}],"wp:attachment":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6423"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}