{"id":292,"date":"2020-03-30T02:59:43","date_gmt":"2020-03-29T17:59:43","guid":{"rendered":"http:\/\/batmask.dothome.co.kr\/?p=292"},"modified":"2025-09-11T18:36:52","modified_gmt":"2025-09-11T09:36:52","slug":"flask-%ec%b2%ab%eb%b2%88%ec%a7%b8-%ec%a1%b0%ec%9a%b0","status":"publish","type":"post","link":"http:\/\/batmask.net\/index.php\/2020\/03\/30\/292\/","title":{"rendered":"Flask: \uccab\ubc88\uc9f8 \uc870\uc6b0"},"content":{"rendered":"\n<p class=\"has-vivid-red-color has-very-light-gray-background-color has-text-color has-background\">\uc815\ubcf4\ub97c \uc5bb\uc744 \ubaa9\uc801\uc73c\ub85c \uc774\ubb38\uc11c\ub97c \uc811\ud558\ub294 \ubd84\uc774 \uc788\ub2e4\uba74 \ubc14\ub85c \ub4a4\ub3cc\uc544 \uac00\uc2dc\uae30 \ubc14\ub780\ub2e4. \ub098\ub3c4 \uc815\ub9ac\uac00 \uc548\ub41c \uc0c1\ud0dc\uc5d0\uc11c \uac1c\ub7b5\uc801\uc73c\ub85c \uacf5\ubd80\uc911\uc778 \ub0b4\uc6a9\uc744 \uadf8\uc800 \uae30\ub85d\uc6a9\uc73c\ub85c \ub0a8\uae30\ub294 \ud3ec\uc2a4\ud305\uc784\uc744 \ubc1d\ud78c\ub2e4.<\/p>\n\n\n\n<p>Flask \ub294 Werkzeug, Jinja2 \ub450\uac00\uc9c0 \ubaa8\ub4c8\uc5d0 \uae30\ubc18\ud55c \ub9c8\uc774\ud06c\ub85c \ud504\ub808\uc784\uc6cd\uc774\ub2e4. Werkzeug\ub294 WSGI \ubaa8\ub4c8\uc774\uace0, Jinja2\ub294 html template rendering engine\uc774\ub2e4. <\/p>\n\n\n\n<p>\uc6f9\uac1c\ubc1c\ub3c4 \uc0dd\uc18c\ud558\uace0 \ucc98\uc74c \uc811\ud558\ub294\uac70\ub77c, \ube60\ub974\uace0 \uc26c\uc6b4 \ud29c\ud1a0\ub9ac\uc5bc\uc744 \ucc3e\uc558\uc5c8\ub294\ub370, \ubb34\uc2a8\uc18c\ub9b0\uc9c0 \ud558\ub098\ub3c4 \ubaa8\ub974\uaca0\ub354\ub77c. \uadf8\ub798\uc11c \ub3cc\uc544\uac04 Flask \uacf5\uc2dd \ubb38\uc11c\ub97c \ubd24\ub294\ub370, \ubb38\uc11c\ud654\uac00 \uc815\ub9d0 \uc798\ub418\uc5b4 \uc788\ub2e4. \uacf5\ubd80\ud558\ub294 \uc785\uc7a5\uc5d0\uc11c\ub3c4 \uc774\uac8c \ucd5c\uace0\ub2e4.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\uc124\uce58\ubb38\uc11c :  <a href=\"https:\/\/flask.palletsprojects.com\/en\/1.1.x\/installation\/\">https:\/\/flask.palletsprojects.com\/en\/1.1.x\/installation\/<\/a> <\/p>\n<\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\ud035 \uc2a4\ud0c0\ud2b8 :  <a href=\"https:\/\/flask.palletsprojects.com\/en\/1.1.x\/installation\/\">https:\/\/flask.palletsprojects.com\/en\/1.1.x\/installation\/<\/a>  \uc5ec\uae30\uc5d0 \uac00\uc7a5 \uae30\ubcf8\uc801\uc778 \ub0b4\uc6a9\ub4e4\uc774 \ub4e4\uc5b4\uc788\ub2e4. \uc774 \ub0b4\uc6a9\uc744 \ud6d1\uc5b4\ubd24\uace0, \uac1c\ub7b5\uc801\uc73c\ub85c \uae30\ub85d\ud574\ubcf4\ub824\ud55c\ub2e4. \ud639\uc2dc \ud544\uc694\ud558\uba74 \uadf8\ub0e5 \uc6d0\ubcf8 \ubb38\uc11c \ubcf4\ub294\uac8c \ucd5c\uace0.<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Install <\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>batmask@DESKTOP-TGQQ06H  \/f\/output_files\/python\/flask_myapp\n$ python -m venv venv\n\nbatmask@DESKTOP-TGQQ06H  \/f\/output_files\/python\/flask_myapp\n$ . .\/venv\/Scripts\/activate\n(venv)\nbatmask@DESKTOP-TGQQ06H  \/f\/output_files\/python\/flask_myapp\n$ pip install Flask\nCollecting Flask\n...(\uc0dd\ub7b5)\n(venv)\nbatmask@DESKTOP-TGQQ06H  \/f\/output_files\/python\/flask_myapp\n$<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F69D50\">batmask@DESKTOP-TGQQ06H<\/span><span style=\"color: #ADBAC7\">  <\/span><span style=\"color: #96D0FF\">\/f\/output_files\/python\/flask_myapp<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">$<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">python<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #6CB6FF\">-m<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">venv<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">venv<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">batmask@DESKTOP-TGQQ06H<\/span><span style=\"color: #ADBAC7\">  <\/span><span style=\"color: #96D0FF\">\/f\/output_files\/python\/flask_myapp<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">$<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">.<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">.\/venv\/Scripts\/activate<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #F69D50\">venv<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">batmask@DESKTOP-TGQQ06H<\/span><span style=\"color: #ADBAC7\">  <\/span><span style=\"color: #96D0FF\">\/f\/output_files\/python\/flask_myapp<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">$<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">pip<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">install<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">Flask<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">Collecting<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">Flask<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6CB6FF\">...<\/span><span style=\"color: #ADBAC7\">(\uc0dd\ub7b5)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #F69D50\">venv<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">batmask@DESKTOP-TGQQ06H<\/span><span style=\"color: #ADBAC7\">  <\/span><span style=\"color: #96D0FF\">\/f\/output_files\/python\/flask_myapp<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">$<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\uc708\ub3c4\uc6b0\uc988 msys2 \ud658\uacbd\uc5d0\uc11c \uc791\uc5c5\ud588\ub2e4. venv\ub85c \uac00\uc0c1\ud658\uacbd\uc744 \ub9cc\ub4e4\uc5b4 \uc92c\uace0, activate \uc2a4\ud06c\ub9bd\ud2b8\ub97c \uc2e4\ud589\ud574\uc11c \uac00\uc0c1\ud658\uacbd\uc744 \ub9cc\ub4e4\uc5b4\uc900\ub2e4. \ud504\ub86c\ud504\ud2b8 \uc55e\uc5d0 (venv)\uac00 \ubcf4\uc774\uba74 \uc131\uacf5. pip\ub85c Flask\ub97c \uc124\uce58\ud558\uba74 \uc54c\uc544\uc11c \uc758\uc874\uc131 \ubaa8\ub4c8\uae4c\uc9c0 \ub2e4 \uc124\uce58\uac00\ub41c\ub2e4.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">The First Run<\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>from flask import Flask\napp = Flask(__name__)\n\n@app.route('\/')\ndef hello_world():\n    return 'Hello, World!'<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F47067\">from<\/span><span style=\"color: #ADBAC7\"> flask <\/span><span style=\"color: #F47067\">import<\/span><span style=\"color: #ADBAC7\"> Flask<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">app <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> Flask(<\/span><span style=\"color: #6CB6FF\">__name__<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">@app.route<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&#39;\/&#39;<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">def<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #DCBDFB\">hello_world<\/span><span style=\"color: #ADBAC7\">():<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">return<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">&#39;Hello, World!&#39;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Flask \uac1d\uccb4\ub97c \uc0dd\uc131\ud558\uace0 \uc6f9 \ub8e8\ud2b8\uc778 &#8216;\/&#8217;\uc5d0\uc11c \uc2e4\ud589\ud560 \ud568\uc218\ub97c \uc9c0\uc815\ud574\uc92c\ub2e4. <\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>$ export FLASK_APP=hello.py\n$ export FLASK_ENV=development\n$ flask run<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #FF938A; font-style: italic\">$<\/span><span style=\"color: #ADBAC7\"> export <\/span><span style=\"color: #6CB6FF\">FLASK_APP<\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\">hello.py<\/span><\/span>\n<span class=\"line\"><span style=\"color: #FF938A; font-style: italic\">$<\/span><span style=\"color: #ADBAC7\"> export <\/span><span style=\"color: #6CB6FF\">FLASK_ENV<\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\">development<\/span><\/span>\n<span class=\"line\"><span style=\"color: #FF938A; font-style: italic\">$<\/span><span style=\"color: #ADBAC7\"> flask run<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\uc704\uc640\uac19\uc774 \ud658\uacbd\ubcc0\uc218\ub97c \uc124\uc815\ud574\uc8fc\uace0 flask run\uc73c\ub85c \uc2e4\ud589\ud558\uba74 \uc11c\ubc84\uac00 \uad6c\ub3d9\ub41c\ub2e4. \ub450\ubc88\uc9f8 \uc904\uc740 \uac1c\ubc1c\uc911 \ub514\ubc84\uadf8\uc6a9\uc73c\ub85c \uc4f8\ub54c \uc0ac\uc6a9\ud55c\ub2e4.<\/p>\n\n\n\n<p>\ub610\ub294 main\ud568\uc218\ub97c \ub9cc\ub4e4\uace0 \uadf8\uc800 \uc2a4\ud06c\ub9bd\ud2b8\ub97c \uc2e4\ud589\ud560 \uc218\ub3c4 \uc788\ub2e4.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>if __name__ == \"__main__\":\n    app.run(debug=True)<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F47067\">if<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #6CB6FF\">__name__<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #F47067\">==<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">&quot;__main__&quot;<\/span><span style=\"color: #ADBAC7\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    app.run(<\/span><span style=\"color: #F69D50\">debug<\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #6CB6FF\">True<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>$ python flask_myapp.py<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #FF938A; font-style: italic\">$<\/span><span style=\"color: #ADBAC7\"> python flask_myapp.py<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">URL \ub2e4\ub8e8\uae30 : routing, building<\/h3>\n\n\n\n<p>\uae30\ubcf8\uc801\uc73c\ub85c <code>@app.route(\"path\")<\/code> \ub370\ucf54\ub808\uc774\ud130\ub97c \ud568\uc218\uc5d0 \ubd99\uc774\uba74, \ud574\ub2f9 \uc6f9 \ub514\ub809\ud1a0\ub9ac\uc5d0 \uc811\uadfc\ud560 \ub54c \ud574\ub2f9 \ud568\uc218\uac00 \uc2e4\ud589\ub41c\ub2e4. <\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>@app.route('\/path\/&lt;path:subpath>')\ndef show_subpath(subpath):\n    # show the subpath after \/path\/\n    return 'Subpath %s' % escape(subpath)<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #DCBDFB\">@app.route<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&#39;\/path\/&lt;path:subpath&gt;&#39;<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">def<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #DCBDFB\">show_subpath<\/span><span style=\"color: #ADBAC7\">(subpath):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #768390\"># show the subpath after \/path\/<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">return<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">&#39;Subpath <\/span><span style=\"color: #F47067\">%s<\/span><span style=\"color: #96D0FF\">&#39;<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\"> escape(subpath)<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\ubcc0\uc218\ub3c4 \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294\ub370, \uc608\uc81c\uc5d0\uc11c &lt;variable&gt; \ud615\ud0dc\ub85c \uc0ac\uc6a9\ud558\uba74 \ud568\uc218\uc758 \uc778\uc790\ub85c \ub118\uc5b4\uac04\ub2e4. variable \ud0c0\uc785\uc740 string, int, float, path, uuid\uac00 \uc788\ub2e4. path\ub294 string\uacfc \uac19\uc73c\ub098, &#8216;\/&#8217;\ub3c4 \uc0ac\uc6a9\uac00\ub2a5\ud55c \ud0c0\uc785\uc774\ub2e4.<\/p>\n\n\n\n<p>HTTP\uc758 GET\uacfc POST\ub97c \ucc98\ub9ac\ud558\uae30\uc704\ud574, \ub2e4\uc74c\uacfc \uac19\uc774 &#8216;methods&#8217; \uc778\uc790\ub97c \uc0ac\uc6a9\ud55c\ub2e4.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>from flask import request\n\n@app.route('\/login', methods=&#91;'GET', 'POST'&#93;)\ndef login():\n    if request.method == 'POST':\n        return do_the_login()\n    else:\n        return show_the_login_form()<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F47067\">from<\/span><span style=\"color: #ADBAC7\"> flask <\/span><span style=\"color: #F47067\">import<\/span><span style=\"color: #ADBAC7\"> request<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">@app.route<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&#39;\/login&#39;<\/span><span style=\"color: #ADBAC7\">, <\/span><span style=\"color: #F69D50\">methods<\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\">&#91;<\/span><span style=\"color: #96D0FF\">&#39;GET&#39;<\/span><span style=\"color: #ADBAC7\">, <\/span><span style=\"color: #96D0FF\">&#39;POST&#39;<\/span><span style=\"color: #ADBAC7\">&#93;)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">def<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #DCBDFB\">login<\/span><span style=\"color: #ADBAC7\">():<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">if<\/span><span style=\"color: #ADBAC7\"> request.method <\/span><span style=\"color: #F47067\">==<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">&#39;POST&#39;<\/span><span style=\"color: #ADBAC7\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">        <\/span><span style=\"color: #F47067\">return<\/span><span style=\"color: #ADBAC7\"> do_the_login()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">else<\/span><span style=\"color: #ADBAC7\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">        <\/span><span style=\"color: #F47067\">return<\/span><span style=\"color: #ADBAC7\"> show_the_login_form()<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\ub0b4\ubd80\uc801\uc73c\ub85c URL\uc0ac\uc6a9\uc2dc, \ud558\ub4dc\ucf54\ub529\ud558\uc9c0 \uc54a\uace0 <code>url_for()<\/code> \ud568\uc218\ub97c \uc4f4\ub2e4. <strong>\uc8fc\uc758\ud560 \uc810\uc740 \uc778\uc790\uba85\uc774 \uacbd\ub85c\uba85\uc774 \uc544\ub2c8\ub77c \uacbd\ub85c\uc5d0 \ud574\ub2f9\ud558\ub294 \ud568\uc218\uba85\uc774\ub2e4.<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>from flask import url_for, redirect\n\n@app.route('\/')\n@app.route(\"\/home\")\ndef home():\n    return \"home!\"\n\n@app.route(\"\/register\", methods=&#91;\"GET\", \"POST\"&#93;)\ndef register():\n    return redirect(url_for(\"home\"))<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F47067\">from<\/span><span style=\"color: #ADBAC7\"> flask <\/span><span style=\"color: #F47067\">import<\/span><span style=\"color: #ADBAC7\"> url_for, redirect<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">@app.route<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&#39;\/&#39;<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">@app.route<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&quot;\/home&quot;<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">def<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #DCBDFB\">home<\/span><span style=\"color: #ADBAC7\">():<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">return<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">&quot;home!&quot;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">@app.route<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&quot;\/register&quot;<\/span><span style=\"color: #ADBAC7\">, <\/span><span style=\"color: #F69D50\">methods<\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\">&#91;<\/span><span style=\"color: #96D0FF\">&quot;GET&quot;<\/span><span style=\"color: #ADBAC7\">, <\/span><span style=\"color: #96D0FF\">&quot;POST&quot;<\/span><span style=\"color: #ADBAC7\">&#93;)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">def<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #DCBDFB\">register<\/span><span style=\"color: #ADBAC7\">():<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">return<\/span><span style=\"color: #ADBAC7\"> redirect(url_for(<\/span><span style=\"color: #96D0FF\">&quot;home&quot;<\/span><span style=\"color: #ADBAC7\">))<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><code>redirect() <\/code>\ub294 \ub9d0 \uadf8\ub300\ub85c \ub9ac\ub514\ub809\uc158 \ud574\uc8fc\ub294 \uae30\ub2a5\uc744 \ud558\uace0, \ub9ac\ub514\ub809\uc158\uc73c\ub85c \uc774\ub3d9\ud560 \uc6f9 \ub514\ub809\ud1a0\ub9ac\ub97c <code>url_for()<\/code>\ub85c \uc0dd\uc131\ud558\ub294\uac78 \ubcf4\uc5ec\uc900\ub2e4. \uc778\uc790\ub85c \ub4e4\uc5b4\uac04 &#8220;home&#8221;\uc740 <code>def home()<\/code>\uc744 \uc758\ubbf8\ud55c\ub2e4.<\/p>\n\n\n\n<p>css \uac19\uc740 static \ud30c\uc77c\uc740 &#8216;\/static&#8217; \ud3f4\ub354\ub97c \uc0dd\uc131\ud558\uace0 \ub123\uc5b4\uc900 \ud6c4, \ub2e4\uc74c\uacfc \uac19\uc774 \ucc38\uc870\uac00 \uac00\ub2a5\ud558\ub2e4.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>url_for('static', filename='style.css')<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #ADBAC7\">url_for(<\/span><span style=\"color: #96D0FF\">&#39;static&#39;<\/span><span style=\"color: #ADBAC7\">, <\/span><span style=\"color: #F69D50\">filename<\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #96D0FF\">&#39;style.css&#39;<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Rendering templates<\/h3>\n\n\n\n<p>html \ud15c\ud50c\ub9bf \uc5d4\uc9c4\uc73c\ub85c Jinja2\ub97c \uc0ac\uc6a9\ud55c\ub2e4\uace0 \ub9d0\ud588\uc5c8\ub2e4. \ud15c\ud50c\ub9bf\uc774\ub780, html\uc548\uc5d0 \ucf54\ub4dc\uac00 \ub4e4\uc5b4\uac00\uace0 \uc774\ub97c \ud15c\ud50c\ub9bf \uc5d4\uc9c4\uc778 Jinja2\uac00 \ud574\uc11d\ud574\uc11c \ucd9c\ub825\ud560 html\uc744 \ub3d9\uc801\uc73c\ub85c \uc0dd\uc131\ud574\uc8fc\ub294\uac78 \ub9d0\ud55c\ub2e4. \ud15c\ud50c\ub9bf \uc5d4\uc9c4\uc778 Jinja2\uc758 \ubb38\ubc95\uc740 \uacf5\uc2dd \uc0ac\uc774\ud2b8\ub97c \ucc38\uc870.  <a href=\"https:\/\/jinja.palletsprojects.com\/en\/2.11.x\/\">https:\/\/jinja.palletsprojects.com\/en\/2.11.x\/<\/a> <\/p>\n\n\n\n<p>\uc790\uc138\ud55c \ub0b4\uc6a9\uc740 \uacf5\uc2dd\ubb38\uc11c\ub97c \ucc38\uace0\ud558\uace0, html\uc548\uc5d0 \uc5b4\ub5bb\uac8c \ud3ec\ud568\ub418\ub294\uc9c0\ub9cc \uc5b8\uae09\ud558\uace0 \ub118\uc5b4\uac00\uaca0\ub2e4. <\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;!DOCTYPE html>\n&lt;html lang=\"en\">\n&lt;head>\n    &lt;title>My Webpage&lt;\/title>\n&lt;\/head>\n&lt;body>\n    &lt;ul id=\"navigation\">\n    {% for item in navigation %}\n        &lt;li>&lt;a href=\"{{ item.href }}\">{{ item.caption }}&lt;\/a>&lt;\/li>\n    {% endfor %}\n    &lt;\/ul>\n\n    &lt;h1>My Webpage&lt;\/h1>\n    {{ a_variable }}\n\n    {# a comment #}\n&lt;\/body>\n&lt;\/html><\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F47067\">&lt;<\/span><span style=\"color: #FF938A; font-style: italic\">!<\/span><span style=\"color: #6CB6FF\">DOCTYPE<\/span><span style=\"color: #ADBAC7\"> html<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">&lt;<\/span><span style=\"color: #ADBAC7\">html lang<\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #96D0FF\">&quot;en&quot;<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">&lt;<\/span><span style=\"color: #ADBAC7\">head<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">&lt;<\/span><span style=\"color: #ADBAC7\">title<\/span><span style=\"color: #F47067\">&gt;<\/span><span style=\"color: #ADBAC7\">My Webpage<\/span><span style=\"color: #F47067\">&lt;\/<\/span><span style=\"color: #ADBAC7\">title<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">&lt;\/<\/span><span style=\"color: #ADBAC7\">head<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">&lt;<\/span><span style=\"color: #ADBAC7\">body<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">&lt;<\/span><span style=\"color: #ADBAC7\">ul <\/span><span style=\"color: #6CB6FF\">id<\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #96D0FF\">&quot;navigation&quot;<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    {<\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #F47067\">for<\/span><span style=\"color: #ADBAC7\"> item <\/span><span style=\"color: #F47067\">in<\/span><span style=\"color: #ADBAC7\"> navigation <\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">        <\/span><span style=\"color: #F47067\">&lt;<\/span><span style=\"color: #ADBAC7\">li<\/span><span style=\"color: #F47067\">&gt;&lt;<\/span><span style=\"color: #ADBAC7\">a href<\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #96D0FF\">&quot;<\/span><span style=\"color: #F47067\">{{<\/span><span style=\"color: #96D0FF\"> item.href <\/span><span style=\"color: #F47067\">}}<\/span><span style=\"color: #96D0FF\">&quot;<\/span><span style=\"color: #F47067\">&gt;<\/span><span style=\"color: #ADBAC7\">{{ item.caption }}<\/span><span style=\"color: #F47067\">&lt;\/<\/span><span style=\"color: #ADBAC7\">a<\/span><span style=\"color: #F47067\">&gt;&lt;\/<\/span><span style=\"color: #ADBAC7\">li<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    {<\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\"> endfor <\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">&lt;\/<\/span><span style=\"color: #ADBAC7\">ul<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">&lt;<\/span><span style=\"color: #ADBAC7\">h1<\/span><span style=\"color: #F47067\">&gt;<\/span><span style=\"color: #ADBAC7\">My Webpage<\/span><span style=\"color: #F47067\">&lt;\/<\/span><span style=\"color: #ADBAC7\">h1<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    {{ a_variable }}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    {<\/span><span style=\"color: #768390\"># a comment #}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">&lt;\/<\/span><span style=\"color: #ADBAC7\">body<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">&lt;\/<\/span><span style=\"color: #ADBAC7\">html<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\uac04\ub2e8\ud55c \uc608\uc81c\uc778\ub370, \ubcc0\uc218\ub294 {{ }} \ub85c \ubb36\uc774\uace0, if\ub098 for \uac19\uc740 \uad6c\ubb38\uc740 {% %}\ub85c \ubb36\uc778\ub2e4. \uc8fc\uc11d\uc740 {# #}\uc774\ub2e4. <\/p>\n\n\n\n<p>\ud15c\ud50c\ub9bf\uc740 base template\uc744 \ub9cc\ub4e4\uace0 \uc774\ub97c \uc0c1\uc18d\ud574\uc11c \uc0ac\uc6a9\ub3c4 \uac00\ub2a5\ud558\ub2e4. <\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;!DOCTYPE html>\n&lt;html lang=\"en\">\n&lt;head>\n    {% block head %}\n    &lt;link rel=\"stylesheet\" href=\"style.css\" \/>\n    &lt;title>{% block title %}{% endblock %} - My Webpage&lt;\/title>\n    {% endblock %}\n&lt;\/head>\n&lt;body>\n    &lt;div id=\"content\">{% block content %}{% endblock %}&lt;\/div>\n    &lt;div id=\"footer\">\n        {% block footer %}\n        \u00a9 Copyright 2008 by &lt;a href=\"http:\/\/domain.invalid\/\">you&lt;\/a>.\n        {% endblock %}\n    &lt;\/div>\n&lt;\/body>\n&lt;\/html><\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F47067\">&lt;<\/span><span style=\"color: #FF938A; font-style: italic\">!<\/span><span style=\"color: #6CB6FF\">DOCTYPE<\/span><span style=\"color: #ADBAC7\"> html<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">&lt;<\/span><span style=\"color: #ADBAC7\">html lang<\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #96D0FF\">&quot;en&quot;<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">&lt;<\/span><span style=\"color: #ADBAC7\">head<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    {<\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\"> block head <\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">&lt;<\/span><span style=\"color: #ADBAC7\">link rel<\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #96D0FF\">&quot;stylesheet&quot;<\/span><span style=\"color: #ADBAC7\"> href<\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #96D0FF\">&quot;style.css&quot;<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #F47067\">\/&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">&lt;<\/span><span style=\"color: #ADBAC7\">title<\/span><span style=\"color: #F47067\">&gt;<\/span><span style=\"color: #ADBAC7\">{<\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\"> block title <\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\">}{<\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\"> endblock <\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\">} <\/span><span style=\"color: #F47067\">-<\/span><span style=\"color: #ADBAC7\"> My Webpage<\/span><span style=\"color: #F47067\">&lt;\/<\/span><span style=\"color: #ADBAC7\">title<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    {<\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\"> endblock <\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">&lt;\/<\/span><span style=\"color: #ADBAC7\">head<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">&lt;<\/span><span style=\"color: #ADBAC7\">body<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">&lt;<\/span><span style=\"color: #ADBAC7\">div <\/span><span style=\"color: #6CB6FF\">id<\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #96D0FF\">&quot;content&quot;<\/span><span style=\"color: #F47067\">&gt;<\/span><span style=\"color: #ADBAC7\">{<\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\"> block content <\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\">}{<\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\"> endblock <\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\">}<\/span><span style=\"color: #F47067\">&lt;\/<\/span><span style=\"color: #ADBAC7\">div<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">&lt;<\/span><span style=\"color: #ADBAC7\">div <\/span><span style=\"color: #6CB6FF\">id<\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #96D0FF\">&quot;footer&quot;<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">        {<\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\"> block footer <\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">        \u00a9 Copyright <\/span><span style=\"color: #6CB6FF\">2008<\/span><span style=\"color: #ADBAC7\"> by <\/span><span style=\"color: #F47067\">&lt;<\/span><span style=\"color: #ADBAC7\">a href<\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #96D0FF\">&quot;http:\/\/domain.invalid\/&quot;<\/span><span style=\"color: #F47067\">&gt;<\/span><span style=\"color: #ADBAC7\">you<\/span><span style=\"color: #F47067\">&lt;\/<\/span><span style=\"color: #ADBAC7\">a<\/span><span style=\"color: #F47067\">&gt;<\/span><span style=\"color: #ADBAC7\">.<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">        {<\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\"> endblock <\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">&lt;\/<\/span><span style=\"color: #ADBAC7\">div<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">&lt;\/<\/span><span style=\"color: #ADBAC7\">body<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">&lt;\/<\/span><span style=\"color: #ADBAC7\">html<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>{% extends \"base.html\" %}\n{% block title %}Index{% endblock %}\n{% block head %}\n    {{ super() }}\n    &lt;style type=\"text\/css\">\n        .important { color: #336699; }\n    &lt;\/style>\n{% endblock %}\n{% block content %}\n    &lt;h1>Index&lt;\/h1>\n    &lt;p class=\"important\">\n      Welcome to my awesome homepage.\n    &lt;\/p>\n{% endblock %}<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #ADBAC7\">{<\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\"> extends <\/span><span style=\"color: #96D0FF\">&quot;base.html&quot;<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">{<\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\"> block title <\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\">}Index{<\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\"> endblock <\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">{<\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\"> block head <\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    {{ <\/span><span style=\"color: #6CB6FF\">super<\/span><span style=\"color: #ADBAC7\">() }}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">&lt;<\/span><span style=\"color: #ADBAC7\">style <\/span><span style=\"color: #6CB6FF\">type<\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #96D0FF\">&quot;text\/css&quot;<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">        .important { color: <\/span><span style=\"color: #768390\">#336699; }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">&lt;\/<\/span><span style=\"color: #ADBAC7\">style<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">{<\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\"> endblock <\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">{<\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\"> block content <\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">&lt;<\/span><span style=\"color: #ADBAC7\">h1<\/span><span style=\"color: #F47067\">&gt;<\/span><span style=\"color: #ADBAC7\">Index<\/span><span style=\"color: #F47067\">&lt;\/<\/span><span style=\"color: #ADBAC7\">h1<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">&lt;<\/span><span style=\"color: #ADBAC7\">p <\/span><span style=\"color: #F47067\">class<\/span><span style=\"color: #ADBAC7\">=<\/span><span style=\"color: #96D0FF\">&quot;important&quot;<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">      Welcome to my awesome homepage.<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">&lt;\/<\/span><span style=\"color: #ADBAC7\">p<\/span><span style=\"color: #F47067\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">{<\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\"> endblock <\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><code>{% extends \"base.html\" %}<\/code> \ub85c base.html\uc744 \uc0c1\uc18d\ubc1b\uace0 \uc788\ub2e4. \ubd80\ubaa8\uc5d0\uc11c \uc815\uc758\ud55c block\uc744 \ub3d9\uc77c\ud558\uac8c \uc368\uc11c \uc624\ubc84\ub77c\uc774\ub4dc\ud558\uba70, <code>{{ super() }}<\/code>\ub85c \ubd80\ubaa8\uc5d0\uc11c \uc815\uc758\ud55c \ube14\ub7ed\uc744 \uc0ac\uc6a9\ud558\ub294\uac8c \ubcf4\uc778\ub2e4.<\/p>\n\n\n\n<p>\ud15c\ud50c\ub9bf\uc5d0\uc120 request, session, g ( get_flashed_messages() )\uc758 3\uac00\uc9c0 \uac1d\uccb4\ub97c \ucc38\uc870\ud558\uac8c\ub41c\ub2e4. <\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Request<\/h3>\n\n\n\n<p>\ud074\ub77c\uc774\uc5b8\ud2b8\ub85c\ubd80\ud130 \uc694\uccad\uc744 \ub2f4\uc740 \uac1d\uccb4. \uc790\uc138\ud55c\uac74 \uad00\ub828 \ubb38\uc11c \ucc38\uc870  <a href=\"https:\/\/flask.palletsprojects.com\/en\/1.1.x\/api\/#flask.Request\">https:\/\/flask.palletsprojects.com\/en\/1.1.x\/api\/#flask.Request<\/a> <\/p>\n\n\n\n<p>GET \ud615\ud0dc\ub294 \uc8fc\uc18c\ub4a4\uc5d0 &#8220;?key=value&#8221; \ud615\ud0dc\ub85c \ubd99\uc5b4\uc11c \uc624\ub294\ub370, \uc774\ub294 request\uc758 args.get()\uc73c\ub85c \uac00\uc838\uc62c \uc218 \uc788\ub2e4.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>searchword = request.args.get('key', '')<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #ADBAC7\">searchword <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> request.args.get(<\/span><span style=\"color: #96D0FF\">&#39;key&#39;<\/span><span style=\"color: #ADBAC7\">, <\/span><span style=\"color: #96D0FF\">&#39;&#39;<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>POST \ubc29\uc2dd\uc758 \uacbd\uc6b0, form \uc5d0 \uc785\ub825\ub418\uc5b4 submit \ub41c \uac12\ub4e4\uc740 \ub2e4\uc74c\uacfc \uac19\uc774 \uac00\uc838\uc628\ub2e4.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>@app.route('\/login', methods=&#91;'POST', 'GET'&#93;)\ndef login():\n    error = None\n    if request.method == 'POST':\n        if valid_login(request.form&#91;'username'&#93;,\n                       request.form&#91;'password'&#93;):\n            return log_the_user_in(request.form&#91;'username'&#93;)\n        else:\n            error = 'Invalid username\/password'\n    # the code below is executed if the request method\n    # was GET or the credentials were invalid\n    return render_template('login.html', error=error)<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #DCBDFB\">@app.route<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&#39;\/login&#39;<\/span><span style=\"color: #ADBAC7\">, <\/span><span style=\"color: #F69D50\">methods<\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\">&#91;<\/span><span style=\"color: #96D0FF\">&#39;POST&#39;<\/span><span style=\"color: #ADBAC7\">, <\/span><span style=\"color: #96D0FF\">&#39;GET&#39;<\/span><span style=\"color: #ADBAC7\">&#93;)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">def<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #DCBDFB\">login<\/span><span style=\"color: #ADBAC7\">():<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    error <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #6CB6FF\">None<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">if<\/span><span style=\"color: #ADBAC7\"> request.method <\/span><span style=\"color: #F47067\">==<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">&#39;POST&#39;<\/span><span style=\"color: #ADBAC7\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">        <\/span><span style=\"color: #F47067\">if<\/span><span style=\"color: #ADBAC7\"> valid_login(request.form&#91;<\/span><span style=\"color: #96D0FF\">&#39;username&#39;<\/span><span style=\"color: #ADBAC7\">&#93;,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">                       request.form&#91;<\/span><span style=\"color: #96D0FF\">&#39;password&#39;<\/span><span style=\"color: #ADBAC7\">&#93;):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">            <\/span><span style=\"color: #F47067\">return<\/span><span style=\"color: #ADBAC7\"> log_the_user_in(request.form&#91;<\/span><span style=\"color: #96D0FF\">&#39;username&#39;<\/span><span style=\"color: #ADBAC7\">&#93;)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">        <\/span><span style=\"color: #F47067\">else<\/span><span style=\"color: #ADBAC7\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">            error <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">&#39;Invalid username\/password&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #768390\"># the code below is executed if the request method<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #768390\"># was GET or the credentials were invalid<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">return<\/span><span style=\"color: #ADBAC7\"> render_template(<\/span><span style=\"color: #96D0FF\">&#39;login.html&#39;<\/span><span style=\"color: #ADBAC7\">, <\/span><span style=\"color: #F69D50\">error<\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\">error)<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">File uploads<\/h3>\n\n\n\n<p> \ud30c\uc77c \uc5c5\ub85c\ub4dc\uc758 \uacbd\uc6b0, html form\uc5d0  <code>enctype=\"multipart\/form-data\"<\/code>  \uc18d\uc131\uc744 \uc8fc\uc5b4\uc57c\ud55c\ub2e4.<\/p>\n\n\n\n<p>\uc5c5\ub85c\ub4dc\ub41c \ud30c\uc77c\uc740 \uba54\ubaa8\ub9ac\ub098 \uc784\uc2dc \uc800\uc7a5\uc18c\uc5d0 \uc800\uc7a5\ub418\uba70, \uc774 \ud30c\uc77c\uc744 \uc800\uc7a5\ud558\uace0\uc790 \ud560 \ub54c save()\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc800\uc7a5\ud55c\ub2e4. <\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>from flask import request\nfrom werkzeug.utils import secure_filename\n\n@app.route('\/upload', methods=&#91;'GET', 'POST'&#93;)\ndef upload_file():\n    if request.method == 'POST':\n        f = request.files&#91;'the_file'&#93;\n        f.save('\/var\/www\/uploads\/' + secure_filename(f.filename))\n    ...<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F47067\">from<\/span><span style=\"color: #ADBAC7\"> flask <\/span><span style=\"color: #F47067\">import<\/span><span style=\"color: #ADBAC7\"> request<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">from<\/span><span style=\"color: #ADBAC7\"> werkzeug.utils <\/span><span style=\"color: #F47067\">import<\/span><span style=\"color: #ADBAC7\"> secure_filename<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">@app.route<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&#39;\/upload&#39;<\/span><span style=\"color: #ADBAC7\">, <\/span><span style=\"color: #F69D50\">methods<\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\">&#91;<\/span><span style=\"color: #96D0FF\">&#39;GET&#39;<\/span><span style=\"color: #ADBAC7\">, <\/span><span style=\"color: #96D0FF\">&#39;POST&#39;<\/span><span style=\"color: #ADBAC7\">&#93;)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">def<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #DCBDFB\">upload_file<\/span><span style=\"color: #ADBAC7\">():<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">if<\/span><span style=\"color: #ADBAC7\"> request.method <\/span><span style=\"color: #F47067\">==<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">&#39;POST&#39;<\/span><span style=\"color: #ADBAC7\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">        f <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> request.files&#91;<\/span><span style=\"color: #96D0FF\">&#39;the_file&#39;<\/span><span style=\"color: #ADBAC7\">&#93;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">        f.save(<\/span><span style=\"color: #96D0FF\">&#39;\/var\/www\/uploads\/&#39;<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #F47067\">+<\/span><span style=\"color: #ADBAC7\"> secure_filename(f.filename))<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #6CB6FF\">...<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\uc784\uc758\uc774\ub984\uc774 \uc544\ub2cc, \ud074\ub77c\uc774\uc5b8\ud2b8\uc0c1 \ud30c\uc77c\uc774\ub984\uc744 \uac00\uc838\uc640 \uc0ac\uc6a9\ud560 \ub550, \ubcf4\uc548\uc0c1\uc758 \uc774\uc288\uac00 \uc788\uc744 \uc218 \uc788\uc5b4 <code>secure_filename(f.filename)<\/code>\uc744 \uc0ac\uc6a9\ud574\uc57c \ud55c\ub2e4.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Cookies<\/h3>\n\n\n\n<p>\ucfe0\ud0a4\ub294 cookies \uc18d\uc131\uc744 \uc0ac\uc6a9\ud558\uace0, \ub2e4\uc74c\ucc98\ub7fc <code>request.cookies.get(\"key\"), response.set_cookie(\"key\", \"value\")<\/code> \uc640 \uac19\uc774 \uc0ac\uc6a9\ud55c\ub2e4. \ubcf4\ub2e4\uc2dc\ud53c, \uac12\ub4e4\uc740 key, value \uc30d\ub4e4\uc778 dictionary \ud615\ud0dc\uc774\ub2e4.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>from flask import request\n\n@app.route('\/')\ndef index():\n    username = request.cookies.get('username')\n    # use cookies.get(key) instead of cookies&#91;key&#93; to not get a\n    # KeyError if the cookie is missing.<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F47067\">from<\/span><span style=\"color: #ADBAC7\"> flask <\/span><span style=\"color: #F47067\">import<\/span><span style=\"color: #ADBAC7\"> request<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">@app.route<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&#39;\/&#39;<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">def<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #DCBDFB\">index<\/span><span style=\"color: #ADBAC7\">():<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    username <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> request.cookies.get(<\/span><span style=\"color: #96D0FF\">&#39;username&#39;<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #768390\"># use cookies.get(key) instead of cookies&#91;key&#93; to not get a<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #768390\"># KeyError if the cookie is missing.<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>from flask import make_response\n\n@app.route('\/')\ndef index():\n    resp = make_response(render_template(...))\n    resp.set_cookie('username', 'the username')\n    return resp<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F47067\">from<\/span><span style=\"color: #ADBAC7\"> flask <\/span><span style=\"color: #F47067\">import<\/span><span style=\"color: #ADBAC7\"> make_response<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">@app.route<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&#39;\/&#39;<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">def<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #DCBDFB\">index<\/span><span style=\"color: #ADBAC7\">():<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    resp <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> make_response(render_template(<\/span><span style=\"color: #6CB6FF\">...<\/span><span style=\"color: #ADBAC7\">))<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    resp.set_cookie(<\/span><span style=\"color: #96D0FF\">&#39;username&#39;<\/span><span style=\"color: #ADBAC7\">, <\/span><span style=\"color: #96D0FF\">&#39;the username&#39;<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">return<\/span><span style=\"color: #ADBAC7\"> resp<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Responses<\/h3>\n\n\n\n<p>Request\ub97c \uc5d0\ub7ec\ucf54\ub4dc\uc640 \ud568\uaed8 \ube60\ub974\uac8c \ubc18\ud658\ud558\ub824\uba74 abort()\ub97c \uc4f4\ub2e4.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>from flask import abort, redirect, url_for\n\n@app.route('\/')\ndef index():\n    return redirect(url_for('login'))\n\n@app.route('\/login')\ndef login():\n    abort(401)\n    this_is_never_executed()<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F47067\">from<\/span><span style=\"color: #ADBAC7\"> flask <\/span><span style=\"color: #F47067\">import<\/span><span style=\"color: #ADBAC7\"> abort, redirect, url_for<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">@app.route<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&#39;\/&#39;<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">def<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #DCBDFB\">index<\/span><span style=\"color: #ADBAC7\">():<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">return<\/span><span style=\"color: #ADBAC7\"> redirect(url_for(<\/span><span style=\"color: #96D0FF\">&#39;login&#39;<\/span><span style=\"color: #ADBAC7\">))<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">@app.route<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&#39;\/login&#39;<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">def<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #DCBDFB\">login<\/span><span style=\"color: #ADBAC7\">():<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    abort(<\/span><span style=\"color: #6CB6FF\">401<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    this_is_never_executed()<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\ucee4\uc2a4\ud140 \uc5d0\ub7ec\ud398\uc774\uc9c0\ub97c \ubcf4\uc5ec\uc8fc\ub824\uba74, errorhandler() \ub370\ucf54\ub808\uc774\ud130\ub97c \uc0ac\uc6a9\ud55c\ub2e4.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>from flask import render_template\n\n@app.errorhandler(404)\ndef page_not_found(error):\n    return render_template('page_not_found.html'), 404<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F47067\">from<\/span><span style=\"color: #ADBAC7\"> flask <\/span><span style=\"color: #F47067\">import<\/span><span style=\"color: #ADBAC7\"> render_template<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">@app.errorhandler<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #6CB6FF\">404<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">def<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #DCBDFB\">page_not_found<\/span><span style=\"color: #ADBAC7\">(error):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">return<\/span><span style=\"color: #ADBAC7\"> render_template(<\/span><span style=\"color: #96D0FF\">&#39;page_not_found.html&#39;<\/span><span style=\"color: #ADBAC7\">), <\/span><span style=\"color: #6CB6FF\">404<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\ub9ac\ud134\uac12\uc5d0 render_template() \ub4a4\uc5d0 \uc5d0\ub7ec\ucf54\ub4dc\uac00 \ubd99\uc5b4\uc788\ub294\uac78 \ubcfc \uc218 \uc788\ub2e4. \uc0ac\uc6a9\ubc95\uc774 \uc880 \ubb18\ud55c\ub370, tuple\ud615\ud0dc\uc758 \ub9ac\ud134\uc774\uba70 Flask\uc5d0\uac8c \uc5d0\ub7ec\ucf54\ub4dc\ub97c \uc54c\ub824\uc8fc\ub294 \uac83\uc774\ub77c\uace0 \ud55c\ub2e4.<\/p>\n\n\n\n<p>Flask\uc5d0\uc120 \ub9ac\ud134\uac12\uc5d0 \ub530\ub77c response\ucc98\ub9ac\uac00 \ub2e4\ub974\uac8c \ub41c\ub2e4. <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>response object\uac00 \ub9ac\ud134\ub418\ub294 \uacbd\uc6b0 :  \uadf8\ub300\ub85c \ubcf4\ub0c4<\/li>\n\n\n\n<li>\ubb38\uc790\uc5f4(String)\uc774 \ub9ac\ud134\ub418\ub294 \uacbd\uc6b0 : \uae30\ubcf8\uac12\uc744 \uc774\uc6a9\ud574\uc11c response object\ub97c \ub9cc\ub4e4\uc5b4 \ubcf4\ub0c4<\/li>\n\n\n\n<li>dict \ud615\uc2dd\uc778 \uacbd\uc6b0 : jsonify() \ub85c JSON \ud3ec\ub9f7\uc73c\ub85c \ubcc0\ud658\ub418\uc5b4 \ubcf4\ub0c4.<\/li>\n\n\n\n<li>tuple \ud615\uc2dd\uc778 \uacbd\uc6b0 : (response, status), (response, headers), (response, status, headers) \ucc98\ub7fc \uc0ac\uc6a9\uc774 \uac00\ub2a5\ud558\ub2e4. status\ub294 \uc55e\uc5d0\uc11c\ucc98\ub7fc \uc5d0\ub7ec\ucf54\ub4dc\ub9cc \uc368\uc918\ub3c4 \ub418\uba70, headers\ub294 list\ub098 dictionary \ud615\ud0dc\uac00 \uac00\ub2a5\ud558\ub2e4.<\/li>\n\n\n\n<li>\uadf8 \uc678\uc5d0\ub294 WSGI application\uc744 \uac00\uc815\ud558\uc5ec response object\ub85c \ubcc0\ud658\ud574 \ubcf4\ub0b8\ub2e4\uace0 \ud55c\ub2e4.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Sessions and Secret key<\/h3>\n\n\n\n<p>\ub2e8\ubc1c\uc131 request\/response\uac00 \uc544\ub2cc, Login \uc720\uc9c0\uc640 \uac19\uc740 \uae30\ub2a5\uc740 Session\uc744 \uc774\uc6a9\ud558\uac8c\ub41c\ub2e4. session\uc740 \uc6d0\ub798 cookie \uae30\ubc18\uc73c\ub85c \ub3d9\uc791\ud558\ub294\ub370, \uc9c1\uc811 cookie\ub97c \ub2e4\ub8e8\uc9c0 \ub9d0\uace0, session \uac1d\uccb4\ub97c \uc774\uc6a9\ud558\ub77c\uace0 \ub418\uc5b4\uc788\ub2e4. \ubb50 \ubcf4\uc548\uc0c1\uc758 \ubb38\uc81c\uaca0\uc9c0.<\/p>\n\n\n\n<p>session\uc744 \uc0ac\uc6a9\ud558\ub824\uba74, encrypt\ub41c \uac12\uc744 \ubcf4\uae30\uc704\ud55c secret key\uac00 \ud544\uc694\ud558\ub2e4. \uc774\uc5d0 \ub300\ud574 \uc0dd\uc131\ud558\ub294 \ubc29\ubc95\uc774 \uc5ec\ub7ec\uac00\uc9c0\uac00 \uc788\ub294\ub370 ( <a href=\"https:\/\/stackoverflow.com\/questions\/34902378\/where-do-i-get-a-secret-key-for-flask\/34903502\">stack overflow \ucc38\uc870<\/a> ), \uac04\ub2e8\ud55c \ubc29\ubc95\uc740 python\uc758 random \uc0dd\uc131\uae30\uc774\ub2e4. <\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>python -c 'import os; print(os.urandom(16))'\nb'\\xba\\xc7K\\x1a\\x06\\xe7p\\x17\\xea\\x0c\\x13\\xa9h\\x9c\\xac\\xb0'<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F69D50\">python<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #6CB6FF\">-c<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">&#39;import os; print(os.urandom(16))&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F69D50\">b<\/span><span style=\"color: #F69D50\">&#39;\\xba\\xc7K\\x1a\\x06\\xe7p\\x17\\xea\\x0c\\x13\\xa9h\\x9c\\xac\\xb0&#39;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\uc774 \uac12\uc744 <code>app.secret_key = b'\\xba\\xc7K\\x1a\\x06\\xe7p\\x17\\xea\\x0c\\x13\\xa9h\\x9c\\xac\\xb0' <\/code>\uc640\uac19\uc774 \uc800\uc7a5\ud55c\ub2e4.<\/p>\n\n\n\n<p>\uacf5\uc2dd \ud398\uc774\uc9c0\uc5d0 \uc788\ub294 \uc0ac\uc6a9\uc608\ub294 \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>from flask import Flask, session, redirect, url_for, request\nfrom markupsafe import escape\n\napp = Flask(__name__)\n\n# Set the secret key to some random bytes. Keep this really secret!\napp.secret_key = b'_5#y2L\"F4Q8z\\n\\xec]\/'\n\n@app.route('\/')\ndef index():\n    if 'username' in session:\n        return 'Logged in as %s' % escape(session&#91;'username'&#93;)\n    return 'You are not logged in'\n\n@app.route('\/login', methods=&#91;'GET', 'POST'&#93;)\ndef login():\n    if request.method == 'POST':\n        session&#91;'username'&#93; = request.form&#91;'username'&#93;\n        return redirect(url_for('index'))\n    return '''\n        &lt;form method=\"post\">\n            &lt;p>&lt;input type=text name=username>\n            &lt;p>&lt;input type=submit value=Login>\n        &lt;\/form>\n    '''\n\n@app.route('\/logout')\ndef logout():\n    # remove the username from the session if it's there\n    session.pop('username', None)\n    return redirect(url_for('index'))<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F47067\">from<\/span><span style=\"color: #ADBAC7\"> flask <\/span><span style=\"color: #F47067\">import<\/span><span style=\"color: #ADBAC7\"> Flask, session, redirect, url_for, request<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">from<\/span><span style=\"color: #ADBAC7\"> markupsafe <\/span><span style=\"color: #F47067\">import<\/span><span style=\"color: #ADBAC7\"> escape<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">app <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> Flask(<\/span><span style=\"color: #6CB6FF\">__name__<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #768390\"># Set the secret key to some random bytes. Keep this really secret!<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">app.secret_key <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #F47067\">b<\/span><span style=\"color: #96D0FF\">&#39;_5#y2L&quot;F4Q8z<\/span><span style=\"color: #F47067\">\\n\\xec<\/span><span style=\"color: #96D0FF\">]\/&#39;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">@app.route<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&#39;\/&#39;<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">def<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #DCBDFB\">index<\/span><span style=\"color: #ADBAC7\">():<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">if<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">&#39;username&#39;<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #F47067\">in<\/span><span style=\"color: #ADBAC7\"> session:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">        <\/span><span style=\"color: #F47067\">return<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">&#39;Logged in as <\/span><span style=\"color: #F47067\">%s<\/span><span style=\"color: #96D0FF\">&#39;<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #F47067\">%<\/span><span style=\"color: #ADBAC7\"> escape(session&#91;<\/span><span style=\"color: #96D0FF\">&#39;username&#39;<\/span><span style=\"color: #ADBAC7\">&#93;)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">return<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">&#39;You are not logged in&#39;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">@app.route<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&#39;\/login&#39;<\/span><span style=\"color: #ADBAC7\">, <\/span><span style=\"color: #F69D50\">methods<\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\">&#91;<\/span><span style=\"color: #96D0FF\">&#39;GET&#39;<\/span><span style=\"color: #ADBAC7\">, <\/span><span style=\"color: #96D0FF\">&#39;POST&#39;<\/span><span style=\"color: #ADBAC7\">&#93;)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">def<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #DCBDFB\">login<\/span><span style=\"color: #ADBAC7\">():<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">if<\/span><span style=\"color: #ADBAC7\"> request.method <\/span><span style=\"color: #F47067\">==<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">&#39;POST&#39;<\/span><span style=\"color: #ADBAC7\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">        session&#91;<\/span><span style=\"color: #96D0FF\">&#39;username&#39;<\/span><span style=\"color: #ADBAC7\">&#93; <\/span><span style=\"color: #F47067\">=<\/span><span style=\"color: #ADBAC7\"> request.form&#91;<\/span><span style=\"color: #96D0FF\">&#39;username&#39;<\/span><span style=\"color: #ADBAC7\">&#93;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">        <\/span><span style=\"color: #F47067\">return<\/span><span style=\"color: #ADBAC7\"> redirect(url_for(<\/span><span style=\"color: #96D0FF\">&#39;index&#39;<\/span><span style=\"color: #ADBAC7\">))<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">return<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #96D0FF\">&#39;&#39;&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #96D0FF\">        &lt;form method=&quot;post&quot;&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #96D0FF\">            &lt;p&gt;&lt;input type=text name=username&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #96D0FF\">            &lt;p&gt;&lt;input type=submit value=Login&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #96D0FF\">        &lt;\/form&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #96D0FF\">    &#39;&#39;&#39;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #DCBDFB\">@app.route<\/span><span style=\"color: #ADBAC7\">(<\/span><span style=\"color: #96D0FF\">&#39;\/logout&#39;<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F47067\">def<\/span><span style=\"color: #ADBAC7\"> <\/span><span style=\"color: #DCBDFB\">logout<\/span><span style=\"color: #ADBAC7\">():<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #768390\"># remove the username from the session if it&#39;s there<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    session.pop(<\/span><span style=\"color: #96D0FF\">&#39;username&#39;<\/span><span style=\"color: #ADBAC7\">, <\/span><span style=\"color: #6CB6FF\">None<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">    <\/span><span style=\"color: #F47067\">return<\/span><span style=\"color: #ADBAC7\"> redirect(url_for(<\/span><span style=\"color: #96D0FF\">&#39;index&#39;<\/span><span style=\"color: #ADBAC7\">))<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Message Flashing<\/h3>\n\n\n\n<p> \uc720\uc800\uac00 \ud53c\ub4dc\ubc31\uc744 \ubc1b\uc744 \uc218 \uc788\uac8c\ud558\ub294 \uc2dc\uc2a4\ud15c\uc73c\ub85c flashing system\uc744 \uc81c\uacf5\ud55c\ub2e4\uace0 \ud55c\ub2e4. \uc774\uac83\uc740 request\ub4a4\uc5d0 \uba54\uc138\uc9c0\ub97c \uae30\ub85d\ud558\uace0, \ub2e4\uc74c\ubc88 request\uc5d0\uc11c \uadf8 \uba54\uc138\uc9c0\ub97c \uc77d\uc5b4\uc624\ub3c4\ub85d \ud558\ub294 \ubc29\ubc95\uc774\ub2e4. \uc815\ud655\ud55c \ubc29\ubc95\uc740 \ubaa8\ub974\uaca0\uc73c\ub098, \uc368\uc788\ub294\ub300\ub85c \uc774\ud574\ud574\ubcf4\uba74, layout template\uc5d0\uc11c template html\uc5d0 \uc791\uc5c5\uc774 \ub418\ub294\uac70 \uac19\ub2e4. \uba54\uc138\uc9c0 \uc4f8 \ub54c flash(), \uc77d\uc5b4\uc62c \ub54c get_flashed_messages() \ub97c \uc774\uc6a9\ud55c\ub2e4.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Logging<\/h3>\n\n\n\n<p>Flask 0.3\ubd80\ud130 \ub85c\uae45\uae30\ub2a5\uc774 \uc0dd\uacbc\ub2e4. Logger\ub97c \uc774\uc6a9\ud55c\ub2e4. \uc608\ub294 \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Roboto-Mono.ttf\" style=\"font-size:clamp(14px, .875rem, 21px);font-family:Code-Pro-Roboto-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#adbac7;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:clamp(20px, 1.25rem, 30px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#22272e\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#adbac7;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>app.logger.debug('A value for debugging')\napp.logger.warning('A warning occurred (%d apples)', 42)\napp.logger.error('An error occurred')<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki github-dark-dimmed\" style=\"background-color: #22272e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #ADBAC7\">app.logger.debug(<\/span><span style=\"color: #96D0FF\">&#39;A value for debugging&#39;<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">app.logger.warning(<\/span><span style=\"color: #96D0FF\">&#39;A warning occurred (<\/span><span style=\"color: #F47067\">%d<\/span><span style=\"color: #96D0FF\"> apples)&#39;<\/span><span style=\"color: #ADBAC7\">, <\/span><span style=\"color: #6CB6FF\">42<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ADBAC7\">app.logger.error(<\/span><span style=\"color: #96D0FF\">&#39;An error occurred&#39;<\/span><span style=\"color: #ADBAC7\">)<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>\uae4c\uba39\uc9c0 \uc54a\uac8c \uac04\ub2e8\ud558\uac8c \uba54\ubaa8\ub9cc \ud558\ub824\uace0 \ud588\ub294\ub370, \ud558\ub098\ud558\ub098 \ub418\uc0c8\uae40\uc9c8 \ud558\ub2e4\ubcf4\ub2c8 \uacb0\uad6d \ud035\uc2a4\ud0c0\ud2b8 \ubb38\uc11c \uac70\uc758 \uc804\uccb4\ub97c \uae01\uc5b4\uc624\ub2e4\uc2dc\ud53c \ud588\ub2e4. \uc0c8\ubcbd\uc5d0 \ud53c\uace4\ud574\uc11c \ub4a4\ub85c\uac08\uc218\ub85d \ub354 \uc2ec\ud574\uc9c4\uac70 \uac19\uc740\ub370, \uc77c\ub2e8 \uadf8\ub0e5 \ubcf5\uc2b5\ud55c\ubc88 \ud588\ub2e4\uace0 \uc0dd\uac01\ud558\uae30\ub85c.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uc815\ubcf4\ub97c \uc5bb\uc744 \ubaa9\uc801\uc73c\ub85c \uc774\ubb38\uc11c\ub97c \uc811\ud558\ub294 \ubd84\uc774 \uc788\ub2e4\uba74 \ubc14\ub85c \ub4a4\ub3cc\uc544 \uac00\uc2dc\uae30 \ubc14\ub780\ub2e4. \ub098\ub3c4 \uc815\ub9ac\uac00 \uc548\ub41c \uc0c1\ud0dc\uc5d0\uc11c \uac1c\ub7b5\uc801\uc73c\ub85c \uacf5\ubd80\uc911\uc778 \ub0b4\uc6a9\uc744 \uadf8\uc800 \uae30\ub85d\uc6a9\uc73c\ub85c \ub0a8\uae30\ub294 \ud3ec\uc2a4\ud305\uc784\uc744 \ubc1d\ud78c\ub2e4. Flask \ub294 Werkzeug, Jinja2 \ub450\uac00\uc9c0 \ubaa8\ub4c8\uc5d0 \uae30\ubc18\ud55c \ub9c8\uc774\ud06c\ub85c \ud504\ub808\uc784\uc6cd\uc774\ub2e4. Werkzeug\ub294 WSGI \ubaa8\ub4c8\uc774\uace0, Jinja2\ub294 html template rendering engine\uc774\ub2e4. \uc6f9\uac1c\ubc1c\ub3c4 \uc0dd\uc18c\ud558\uace0 \ucc98\uc74c \uc811\ud558\ub294\uac70\ub77c, \ube60\ub974\uace0 \uc26c\uc6b4 \ud29c\ud1a0\ub9ac\uc5bc\uc744 \ucc3e\uc558\uc5c8\ub294\ub370, \ubb34\uc2a8\uc18c\ub9b0\uc9c0 \ud558\ub098\ub3c4 \ubaa8\ub974\uaca0\ub354\ub77c. \uadf8\ub798\uc11c \ub3cc\uc544\uac04 Flask \uacf5\uc2dd [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24,33],"tags":[100,101,35,55,138],"class_list":["post-292","post","type-post","status-publish","format-standard","hentry","category-note4reference","category-python","tag-flask","tag-just-for-me","tag-python","tag-python-kr","tag-flask-kr"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/posts\/292","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/comments?post=292"}],"version-history":[{"count":11,"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/posts\/292\/revisions"}],"predecessor-version":[{"id":3445,"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/posts\/292\/revisions\/3445"}],"wp:attachment":[{"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/media?parent=292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/categories?post=292"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/batmask.net\/index.php\/wp-json\/wp\/v2\/tags?post=292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}