{"id":73,"date":"2024-12-04T04:23:49","date_gmt":"2024-12-04T04:23:49","guid":{"rendered":"http:\/\/211.230.203.47\/wordpress\/?p=73"},"modified":"2024-12-04T04:23:49","modified_gmt":"2024-12-04T04:23:49","slug":"%ec%9a%b0%eb%b6%84%ed%88%ac%ec%97%90%ec%84%9c-flask-%ec%84%a4%ec%b9%98","status":"publish","type":"post","link":"https:\/\/www.soon7shop.kr\/wordpress\/?p=73","title":{"rendered":"\uc6b0\ubd84\ud22c\uc5d0\uc11c Flask \uc124\uce58"},"content":{"rendered":"<p>Ubuntu\uc5d0\uc11c Flask\ub97c \uc124\uce58\ud558\ub294 \ubc29\ubc95\uc744 \uc548\ub0b4\ub4dc\ub9ac\uaca0\uc2b5\ub2c8\ub2e4. Flask\ub294 Python \ud328\ud0a4\uc9c0 \uad00\ub9ac\uc790\uc778 <code>pip<\/code>\uc744 \ud1b5\ud574 \uac04\ud3b8\ud558\uac8c \uc124\uce58\ud560 \uc218 \uc788\uc73c\uba70, \uac00\uc0c1 \ud658\uacbd\uc744 \uc0ac\uc6a9\ud558\ub294 \uac83\uc774 \uad8c\uc7a5\ub429\ub2c8\ub2e4.<\/p>\n<h3>1. Python\uacfc pip \uc124\uce58 \ud655\uc778<\/h3>\n<p>\uba3c\uc800 Python\uacfc pip\uc774 \uc124\uce58\ub418\uc5b4 \uc788\ub294\uc9c0 \ud655\uc778\ud569\ub2c8\ub2e4. Ubuntu 20.04 \uc774\uc0c1 \ubc84\uc804\uc5d0\uc11c\ub294 Python3\uac00 \uae30\ubcf8 \uc124\uce58\ub418\uc5b4 \uc788\uc9c0\ub9cc, \uadf8\ub807\uc9c0 \uc54a\uc740 \uacbd\uc6b0 \uc544\ub798\uc640 \uac19\uc774 \uc124\uce58\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">sudo apt update<br \/>\nsudo apt install python3 python3-pip<br \/>\n<\/code><\/div>\n<\/div>\n<p>\uc124\uce58 \ud655\uc778:<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">python3 --version<br \/>\npip3 --version<br \/>\n<\/code><\/div>\n<\/div>\n<h3>2. Python \uac00\uc0c1 \ud658\uacbd \ub9cc\ub4e4\uae30<\/h3>\n<p>\uac00\uc0c1 \ud658\uacbd\uc744 \ub9cc\ub4e4\uc5b4 Python \ud328\ud0a4\uc9c0\ub4e4\uc774 \uc2dc\uc2a4\ud15c\uc5d0 \uc601\ud5a5\uc744 \uc8fc\uc9c0 \uc54a\ub3c4\ub85d \ud558\ub294 \uac83\uc774 \uc88b\uc2b5\ub2c8\ub2e4. \uac00\uc0c1 \ud658\uacbd\uc744 \uc0ac\uc6a9\ud558\uba74 \ud504\ub85c\uc81d\ud2b8\ub9c8\ub2e4 \ub3c5\ub9bd\uc801\uc73c\ub85c \ud328\ud0a4\uc9c0\ub97c \uad00\ub9ac\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">sudo apt install python3-venv  <span class=\"hljs-comment\"># \uac00\uc0c1 \ud658\uacbd \ud328\ud0a4\uc9c0 \uc124\uce58 (\ud544\uc694\ud55c \uacbd\uc6b0)<\/span><br \/>\npython3 -m venv my_flask_env  <span class=\"hljs-comment\"># my_flask_env\ub77c\ub294 \uac00\uc0c1 \ud658\uacbd \uc0dd\uc131<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<p>\uac00\uc0c1 \ud658\uacbd\uc744 \ud65c\uc131\ud654\ud569\ub2c8\ub2e4.<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\"><span class=\"hljs-built_in\">source<\/span> my_flask_env\/bin\/activate<br \/>\n<\/code><\/div>\n<\/div>\n<p>\ud65c\uc131\ud654\uac00 \uc644\ub8cc\ub418\uba74 <code>(my_flask_env)<\/code>\ub77c\ub294 \ud504\ub86c\ud504\ud2b8\uac00 \ud45c\uc2dc\ub429\ub2c8\ub2e4.<\/p>\n<h3>3. Flask \uc124\uce58<\/h3>\n<p>\uac00\uc0c1 \ud658\uacbd\uc774 \ud65c\uc131\ud654\ub41c \uc0c1\ud0dc\uc5d0\uc11c Flask\ub97c \uc124\uce58\ud569\ub2c8\ub2e4.<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">pip install Flask<br \/>\n<\/code><\/div>\n<\/div>\n<p>\uc124\uce58\uac00 \uc644\ub8cc\ub418\uba74 Flask \ubc84\uc804\uc744 \ud655\uc778\ud558\uc5ec \uc815\uc0c1 \uc124\uce58\ub418\uc5c8\ub294\uc9c0 \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">flask --version<br \/>\n<\/code><\/div>\n<\/div>\n<h3>4. \uac04\ub2e8\ud55c Flask \uc560\ud50c\ub9ac\ucf00\uc774\uc158 \uc2e4\ud589<\/h3>\n<p>Flask \uc124\uce58\ub97c \ud655\uc778\ud558\uae30 \uc704\ud574 \uac04\ub2e8\ud55c \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc744 \ub9cc\ub4e4\uc5b4 \ubd05\ub2c8\ub2e4.<\/p>\n<p><strong>app.py<\/strong>\ub77c\ub294 \ud30c\uc77c\uc744 \uc0dd\uc131\ud558\uace0 \ub2e4\uc74c\uacfc \uac19\uc774 \uc791\uc131\ud569\ub2c8\ub2e4.<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\"><\/div>\n<p>from flask import Flask<\/p>\n<p>app = Flask(__name__)<\/p>\n<p>@app.route(&#8220;\/&#8221;)<br \/>\ndef hello():<br \/>\nreturn &#8220;Hello, Flask on Ubuntu!&#8221;<\/p>\n<p>if __name__ == &#8220;__main__&#8221;:<br \/>\napp.run()<\/p>\n<h3>5.Flask \uc560\ud50c\ub9ac\ucf00\uc774\uc158 \uc2e4\ud589<\/h3>\n<p><code>FLASK_APP<\/code> \ud658\uacbd \ubcc0\uc218\ub97c \uc124\uc815\ud558\uace0 Flask \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc744 \uc2e4\ud589\ud569\ub2c8\ub2e4.<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center select-none py-1\">\ucf54\ub4dc \ubcf5\uc0ac<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\"><span class=\"hljs-built_in\">export<\/span> FLASK_APP=app.py<br \/>\nflask run<br \/>\n<\/code><\/div>\n<\/div>\n<p>\uc774 \uba85\ub839\uc5b4\ub85c \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc774 \uc2e4\ud589\ub418\uba70, \uae30\ubcf8\uc801\uc73c\ub85c <code>http:\/\/127.0.0.1:5000<\/code>\uc5d0\uc11c Flask \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc744 \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<p>\uc774\uc81c Ubuntu\uc5d0\uc11c Flask\uac00 \uc815\uc0c1\uc801\uc73c\ub85c \uc124\uce58\ub418\uace0 \uc2e4\ud589\ub41c \uac83\uc744 \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu\uc5d0\uc11c Flask\ub97c \uc124\uce58\ud558\ub294 \ubc29\ubc95\uc744 \uc548\ub0b4\ub4dc\ub9ac\uaca0\uc2b5\ub2c8\ub2e4. Flask\ub294 Python \ud328\ud0a4\uc9c0 \uad00\ub9ac\uc790\uc778 pip\uc744 \ud1b5\ud574 \uac04\ud3b8\ud558\uac8c \uc124\uce58\ud560 \uc218 \uc788\uc73c\uba70, \uac00\uc0c1 \ud658\uacbd\uc744 \uc0ac\uc6a9\ud558\ub294 \uac83\uc774 \uad8c\uc7a5\ub429\ub2c8\ub2e4. 1. Python\uacfc pip \uc124\uce58 \ud655\uc778 \uba3c\uc800 Python\uacfc pip\uc774 \uc124\uce58\ub418\uc5b4 \uc788\ub294\uc9c0 \ud655\uc778\ud569\ub2c8\ub2e4. Ubuntu 20.04 \uc774\uc0c1 \ubc84\uc804\uc5d0\uc11c\ub294 Python3\uac00 \uae30\ubcf8 \uc124\uce58\ub418\uc5b4 \uc788\uc9c0\ub9cc, \uadf8\ub807\uc9c0 \uc54a\uc740 \uacbd\uc6b0 \uc544\ub798\uc640 \uac19\uc774 \uc124\uce58\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. bash sudo apt update sudo apt install python3 &hellip; <a href=\"https:\/\/www.soon7shop.kr\/wordpress\/?p=73\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;\uc6b0\ubd84\ud22c\uc5d0\uc11c Flask \uc124\uce58&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-73","post","type-post","status-publish","format-standard","hentry","category-6"],"_links":{"self":[{"href":"https:\/\/www.soon7shop.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/73","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.soon7shop.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.soon7shop.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.soon7shop.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.soon7shop.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=73"}],"version-history":[{"count":1,"href":"https:\/\/www.soon7shop.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/73\/revisions"}],"predecessor-version":[{"id":74,"href":"https:\/\/www.soon7shop.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/73\/revisions\/74"}],"wp:attachment":[{"href":"https:\/\/www.soon7shop.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=73"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.soon7shop.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=73"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.soon7shop.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=73"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}