{"id":6555,"date":"2021-08-10T01:34:00","date_gmt":"2021-08-09T17:34:00","guid":{"rendered":"https:\/\/vip.fxxkpython.com\/?p=6555"},"modified":"2021-08-12T01:51:28","modified_gmt":"2021-08-11T17:51:28","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-21-%e5%a6%82%e4%bd%95%e6%9f%a5%e7%9c%8b%e4%bd%a0","status":"publish","type":"post","link":"https:\/\/vip.fxxkpython.com\/?p=6555","title":{"rendered":"\u4f7f\u7528 Python \u4ece 0 \u5f00\u53d1\u5c5e\u4e8e\u4f60\u7684\u4e2a\u4eba\u7ba1\u7406\u7cfb\u7edf 21 | \u5982\u4f55\u67e5\u770b\u4f60\u7684 Flask debug \u4fe1\u606f"},"content":{"rendered":"\n<p>\u73b0\u5728\u4f60\u7684\u7cfb\u7edf\u5df2\u7ecf\u6709\u90a3\u4e48\u70b9\u300c\u50cf\u6837\u300d\u4e86\uff0c\u5f53\u7136\uff0c\u8fd8\u6709\u5f88\u591a\u9700\u8981\u4f60\u53bb\u5b8c\u5584\u7684\u5730\u65b9\uff0c\u6bd4\u5982\u5f80\u540e\u6211\u4f1a\u7ed9\u4f60\u8bb2\u7684\u6d4b\u8bd5\u65b9\u6cd5\uff0c\u6a21\u5757\u4f18\u5316\u7b49\uff0c\u4eca\u5929\u5148\u7ed9\u4f60\u8bb2\u4e00\u4e0b\uff0c\u600e\u4e48\u53bb\u67e5\u770b\u4f60\u7cfb\u7edf\u7684 debug \u4fe1\u606f\u3002<\/p>\n\n\n\n<p>\u50cf\u8fd9\u6837\u5f53\u4f60\u7684 app \u5904\u4e8e debug \u6a21\u5f0f\u7684\u65f6\u5019\uff0c\u8ba9 debug \u4fe1\u606f\u9762\u677f\u51fa\u73b0\u5728\u4f60\u7684\u7cfb\u7edf\u4e2d\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"374\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/08\/\u622a\u5c4f2021-08-12-\u4e0a\u534812.18.49-1024x374.png\" alt=\"\" class=\"wp-image-6556\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/08\/\u622a\u5c4f2021-08-12-\u4e0a\u534812.18.49-1024x374.png 1024w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/08\/\u622a\u5c4f2021-08-12-\u4e0a\u534812.18.49-300x110.png 300w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/08\/\u622a\u5c4f2021-08-12-\u4e0a\u534812.18.49-768x280.png 768w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/08\/\u622a\u5c4f2021-08-12-\u4e0a\u534812.18.49-769x281.png 769w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/08\/\u622a\u5c4f2021-08-12-\u4e0a\u534812.18.49.png 1115w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<h2>Flask-DebugToolbar<\/h2>\n\n\n\n<p>\u4f60\u53ef\u4ee5\u4f7f\u7528 Flask-DebugToolbar \u63d2\u4ef6\u6765\u5b9e\u73b0\uff0c\u5148\u8fdb\u5165\u4f60\u7684\u865a\u62df\u73af\u5883\u4e2d\uff0c\u7136\u540e\u5b89\u88c5\u4e00\u6ce2\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>pipenv install flask-debugtoolbar<\/p><\/blockquote>\n\n\n\n<p>\u63a5\u7740\u5728\u4f60\u53ef\u4ee5\u5bfc\u5165\u5e76\u521d\u59cb\u5316\u4f7f\u7528\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_debugtoolbar import DebugToolbarExtension\n\napp.debug = True\ntoolbar = DebugToolbarExtension(app)\n<\/pre><\/div>\n\n\n\n<p>\u8fd9\u91cc\u7684 app.debug \u9700\u8981\u8bbe\u7f6e\u4e3a True \u5b83\u624d\u53ef\u4ee5\u88ab\u4f7f\u7528\u3002<\/p>\n\n\n\n<p>\u5f88\u7b80\u5355\uff0c\u5f53\u4f60\u8c03\u7528\u4e86 DebugToolbarExtension \u540e\uff0c\u8fd9\u4e2a debug \u4fe1\u606f\u9762\u677f\u5c31\u4f1a\u81ea\u52a8\u6ce8\u5165\u5230\u4f60\u7684\u7cfb\u7edf\u9875\u9762\u4e2d\u3002<\/p>\n\n\n\n<p>\u73b0\u5728\u8fd0\u884c\u4f60\u7684\u9879\u76ee\uff0c\u4f60\u5c31\u53ef\u4ee5\u770b\u5230\u5728\u4f60\u7684\u9875\u9762\u53f3\u8fb9\uff0c\u51fa\u73b0\u4e86\u8fd9\u4e2a debug \u4fe1\u606f\u9762\u677f\u3002<\/p>\n\n\n\n<p>\u90a3\u4e48\u8fd9\u4e9b item \u5206\u522b\u662f\u4ec0\u4e48\u610f\u601d\u5462\uff1f<\/p>\n\n\n\n<h2>\u67e5\u770b\u7248\u672c<\/h2>\n\n\n\n<p>\u70b9\u5f00 Version \u8fd9\u4e2a Item\uff0c\u4f60\u4f1a\u770b\u5230\u5982\u4e0b\u4fe1\u606f\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"715\" height=\"576\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/08\/\u622a\u5c4f2021-08-12-\u4e0a\u534812.25.03-1.png\" alt=\"\" class=\"wp-image-6558\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/08\/\u622a\u5c4f2021-08-12-\u4e0a\u534812.25.03-1.png 715w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2021\/08\/\u622a\u5c4f2021-08-12-\u4e0a\u534812.25.03-1-300x242.png 300w\" sizes=\"(max-width: 715px) 100vw, 715px\" \/><\/figure><\/div>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u4f60\u9879\u76ee\u4e2d\u7528\u5230\u7684<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%3D6555\">\u767b\u9646<\/a> \u540e\u624d\u53ef\u4ee5\u6d4f\u89c8<\/div>OK\uff0c\u4ee5\u4e0a\u5c31\u662f Flask-DebugToolbar \u7684\u4ecb\u7ecd\uff0c\u6211\u4eec\u4e0b\u56de\u89c1\uff0cpeace\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u73b0\u5728\u4f60\u7684\u7cfb\u7edf\u5df2\u7ecf\u6709\u90a3\u4e48\u70b9\u300c\u50cf\u6837\u300d\u4e86\uff0c\u5f53\u7136\uff0c\u8fd8\u6709\u5f88\u591a\u9700\u8981\u4f60\u53bb\u5b8c\u5584\u7684\u5730\u65b9\uff0c\u6bd4\u5982\u5f80\u540e\u6211\u4f1a\u7ed9\u4f60\u8bb2\u7684\u6d4b\u8bd5\u65b9\u6cd5\uff0c\u6a21\u5757\u4f18\u5316\u7b49\uff0c\u4eca\u5929\u5148\u7ed9\u4f60\u8bb2\u4e00\u4e0b\uff0c\u600e\u4e48\u53bb\u67e5\u770b\u4f60\u7cfb\u7edf\u7684 debug \u4fe1\u606f\u3002 \u50cf\u8fd9\u6837\u5f53\u4f60\u7684 app \u5904\u4e8e debug \u6a21\u5f0f\u7684\u65f6\u5019\uff0c\u8ba9 debug \u4fe1\u606f\u9762\u677f\u51fa\u73b0&hellip;<\/p>\n","protected":false},"author":1,"featured_media":6556,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[99],"tags":[125,614],"_links":{"self":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/6555"}],"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=6555"}],"version-history":[{"count":3,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/6555\/revisions"}],"predecessor-version":[{"id":6578,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/6555\/revisions\/6578"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/media\/6556"}],"wp:attachment":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6555"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6555"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6555"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}