1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[399],{7677:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/build-up/python_flask",function(){return t(8204)}])},6692:function(e,n,t){"use strict";var s=t(5893),a=(t(7294),t(4298),function(){return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:"2em",style:{fillRule:"evenodd",clipRule:"evenodd",strokeLinejoin:"round",strokeMiterlimit:2},children:[(0,s.jsx)("rect",{width:1024,height:1024,rx:180,fill:"#060D0E"}),(0,s.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M512.727 93.38c111.979 0 217.255 43.544 296.438 122.611 79.179 79.067 122.787 184.191 122.787 296.01 0 111.817-43.608 216.941-122.787 296.008-79.183 79.067-184.459 122.611-296.438 122.611-111.98 0-217.257-43.544-296.438-122.611-79.181-79.067-122.788-184.191-122.788-296.008 0-111.819 43.607-216.943 122.788-296.01C295.47 136.924 400.747 93.38 512.727 93.38ZM148.16 512.001c0 200.731 163.544 364.038 364.567 364.038s364.565-163.307 364.565-364.038c0-200.733-163.542-364.04-364.565-364.04S148.16 311.268 148.16 512.001Z",fill:"#0AE0F0"}),(0,s.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M363.584 725.579h72.778l226.914-425.113h-73.384L363.584 725.579Z",fill:"#fff"})]})});n.Z={projectLink:"https://github.com/blinksh/docs",docsRepositoryBase:"https://github.com/blinksh/docs/blob/master/src/pages",projectChatLink:"https://discord.gg/ZTtMfvK",titleSuffix:" \u2013 Blink Shell",logo:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a,{}),(0,s.jsx)("span",{className:"mr-2 ml-2 font-extrabold hidden md:inline",children:"Blink Shell"}),(0,s.jsx)("span",{className:"text-gray-600 font-normal hidden md:inline",children:"Top mobile terminal for Apple devices."})]}),head:function(){return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("meta",{name:"msapplication-TileColor",content:"#ffffff"}),(0,s.jsx)("meta",{name:"theme-color",content:"#ffffff"}),(0,s.jsx)("meta",{name:"viewport",content:"width=device-width, initial-scale=1.0"}),(0,s.jsx)("meta",{httpEquiv:"Content-Language",content:"en"}),(0,s.jsx)("meta",{name:"description",content:"Blink Shell: The top mobile terminal for Apple devices. Blazing fast, full-featured, and loved by developers around the world. It's giving you the freedom to develop anywhere, anytime."}),(0,s.jsx)("meta",{name:"og:description",content:"Blink Shell: The top mobile terminal for Apple devices. Blazing fast, full-featured, and loved by developers around the world. It's giving you the freedom to develop anywhere, anytime."}),(0,s.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,s.jsx)("meta",{name:"twitter:handle",content:"blinkshell"}),(0,s.jsx)("meta",{name:"twitter:image",content:"https://blink.sh/og.png"}),(0,s.jsx)("meta",{name:"twitter:site:domain",content:"blink.sh"}),(0,s.jsx)("meta",{name:"twitter:url",content:"https://blink.sh"}),(0,s.jsx)("meta",{name:"og:title",content:"Blink Shell: Blink Shell: The top mobile terminal for Apple devices."}),(0,s.jsx)("meta",{name:"og:image",content:"https://docs.blink.sh/og.png"}),(0,s.jsx)("meta",{name:"apple-mobile-web-app-title",content:"Blink Shell"}),(0,s.jsx)("link",{rel:"apple-touch-icon",sizes:"180x180",href:"/apple-icon-180x180.png"}),(0,s.jsx)("link",{rel:"icon",type:"image/png",sizes:"192x192",href:"/android-icon-192x192.png"}),(0,s.jsx)("link",{rel:"icon",type:"image/png",sizes:"32x32",href:"/favicon-32x32.png"}),(0,s.jsx)("link",{rel:"icon",type:"image/png",sizes:"96x96",href:"/favicon-96x96.png"}),(0,s.jsx)("link",{rel:"icon",type:"image/png",sizes:"16x16",href:"/favicon-16x16.png"}),(0,s.jsx)("meta",{name:"msapplication-TileImage",content:"/ms-icon-144x144.png"}),(0,s.jsx)("meta",{name:"apple-itunes-app",content:"app-id=1594898306"}),(0,s.jsx)("script",{src:"https://www.googletagmanager.com/gtag/js?id=UA-84834352-1",strategy:"afterInteractive"}),(0,s.jsx)("script",{id:"google-analytics",strategy:"afterInteractive",children:"\n\t window.dataLayer = window.dataLayer || [];\n\t function gtag(){window.dataLayer.push(arguments);}\n\t gtag('js', new Date());\n\n\t gtag('config', 'UA-84834352-1');\n\t"})]})},search:!0,unstable_faviconGlyph:"\u2726",defaultMenuCollapsed:!0,prevLinks:!0,nextLinks:!0,floatTOC:!0,footer:!0,footerEditLink:"Edit this page on GitHub",footerText:(0,s.jsxs)(s.Fragment,{children:["\xa9 ",(new Date).getFullYear()," Blink Shell is developed by Blink Shell Inc."]}),darkMode:!0}},8204:function(e,n,t){"use strict";t.r(n);var s=t(1799),a=t(9396),o=t(5893),l=t(7308),i=t(5142),r=t(6692),c=t(1151),d=(t(5675),"Build up Python + Flask projets");function h(e){var n=Object.assign({h1:"h1",p:"p",strong:"strong",div:"div",pre:"pre",code:"code",span:"span",h2:"h2",h3:"h3",a:"a",blockquote:"blockquote"},(0,c.ah)(),e.components);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h1,{children:"Build up Python + Flask projets"}),"\n",(0,o.jsxs)(n.p,{children:["You can use ",(0,o.jsx)(n.strong,{children:"Blink Build"})," to run your Flask project in an ",(0,o.jsx)(n.strong,{children:"isolated development environment"}),", that you can easily launch from your iPhone or iPad. Python 3 is supported in the default Hacker Tools container, so we can get started in no time:"]}),"\n",(0,o.jsx)(n.div,{"data-rehype-pretty-code-fragment":"","data-nextra-code":"",children:(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{"data-language":"bash","data-theme":"default",children:(0,o.jsxs)(n.span,{className:"line",children:[(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:"blink"}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-keyword)"},children:">"}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:" build mosh"})]})})})}),"\n",(0,o.jsxs)(n.p,{children:["Create and go to the ",(0,o.jsx)(n.code,{children:"hello"})," project folder:"]}),"\n",(0,o.jsx)(n.div,{"data-rehype-pretty-code-fragment":"","data-nextra-code":"",children:(0,o.jsx)(n.pre,{children:(0,o.jsxs)(n.code,{"data-language":"bash","data-theme":"default",children:[(0,o.jsxs)(n.span,{className:"line",children:[(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:"root \u279c "}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-keyword)"},children:"~"}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:" $ mkdir hello"})]}),"\n",(0,o.jsxs)(n.span,{className:"line",children:[(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:"root \u279c "}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-keyword)"},children:"~"}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:" $ "}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-function)"},children:"cd"}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:" hello"})]})]})})}),"\n",(0,o.jsx)(n.p,{children:"Create and activate a virtual environment:"}),"\n",(0,o.jsx)(n.div,{"data-rehype-pretty-code-fragment":"","data-nextra-code":"",children:(0,o.jsx)(n.pre,{children:(0,o.jsxs)(n.code,{"data-language":"bash","data-theme":"default",children:[(0,o.jsxs)(n.span,{className:"line",children:[(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:"root \u279c "}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-keyword)"},children:"~"}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:"/hello $ python -m venv venv"})]}),"\n",(0,o.jsxs)(n.span,{className:"line",children:[(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:"root \u279c "}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-keyword)"},children:"~"}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:"/hello $ "}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-function)"},children:"source"}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:" venv/bin/activate"})]})]})})}),"\n",(0,o.jsx)(n.p,{children:"Last step is installing Flask itself:"}),"\n",(0,o.jsx)(n.div,{"data-rehype-pretty-code-fragment":"","data-nextra-code":"",children:(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{"data-language":"bash","data-theme":"default",children:(0,o.jsxs)(n.span,{className:"line",children:[(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:"root \u279c "}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-keyword)"},children:"~"}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:"/hello $ pip install flask"})]})})})}),"\n",(0,o.jsx)(n.h2,{id:"developing",children:"Developing"}),"\n",(0,o.jsxs)(n.p,{children:["Create in VIM*(or your favorite)* editor ",(0,o.jsx)(n.code,{children:"app.py"}),", and add:"]}),"\n",(0,o.jsx)(n.div,{"data-rehype-pretty-code-fragment":"","data-nextra-code":"",children:(0,o.jsx)(n.pre,{children:(0,o.jsxs)(n.code,{"data-language":"python","data-theme":"default",children:[(0,o.jsxs)(n.span,{className:"line",children:[(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:" flask "}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:" Flask"})]}),"\n",(0,o.jsx)(n.span,{className:"line",children:" "}),"\n",(0,o.jsxs)(n.span,{className:"line",children:[(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:"app "}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-function)"},children:"Flask"}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-punctuation)"},children:"("}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-constant)"},children:"__name__"}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-punctuation)"},children:")"})]}),"\n",(0,o.jsx)(n.span,{className:"line",children:" "}),"\n",(0,o.jsxs)(n.span,{className:"line",children:[(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-function)"},children:"@app"}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-punctuation)"},children:"."}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-function)"},children:"route"}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-punctuation)"},children:"("}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"/"'}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-punctuation)"},children:")"})]}),"\n",(0,o.jsxs)(n.span,{className:"line",children:[(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-keyword)"},children:"def"}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-function)"},children:"hello_world"}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"}
1,children:"():"})]}),"\n",(0,o.jsxs)(n.span,{className:"line",children:[(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-keyword)"},children:"return"}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,o.jsx)(n.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"<p>Hello, World!</p>"'})]})]})})}),"\n",(0,o.jsx)(n.p,{children:"Now run your development server:"}),"\n",(0,o.jsx)(n.div,{"data-rehype-pretty-code-fragment":"","data-nextra-code":"",children:(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{"data-language":"bash","data-theme":"default",children:(0,o.jsx)(n.span,{className:"line",children:(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:"flask run --host=0.0.0.0"})})})})}),"\n",(0,o.jsx)(n.p,{children:"We use host 0.0.0.0 so the server is exposed to the Build container, but not to the outside world."}),"\n",(0,o.jsx)(n.h3,{id:"opening-ports",children:"Opening Ports"}),"\n",(0,o.jsx)(n.p,{children:"Blink Build can transparently expose the ports on the remote container inside your local device. In this case, we want to access the Flask server running on port 5000, in our localhost on port 5001:"}),"\n",(0,o.jsx)(n.div,{"data-rehype-pretty-code-fragment":"","data-nextra-code":"",children:(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{"data-language":"bash","data-theme":"default",children:(0,o.jsx)(n.span,{className:"line",children:(0,o.jsx)(n.span,{style:{color:"var(--shiki-color-text)"},children:"build ports add htools 5000 5001"})})})})}),"\n",(0,o.jsxs)(n.p,{children:["Now you can access your project from ",(0,o.jsx)(n.a,{href:"http://localhost:5001",children:"http://localhost:5001"}),"!"]}),"\n",(0,o.jsxs)(n.blockquote,{children:["\n",(0,o.jsx)(n.p,{children:"\ud83d\udc4d Blink Build exposes ports securely over a Wireguard interface."}),"\n"]}),"\n",(0,o.jsx)(n.h2,{id:"comments",children:"Comments"}),"\n",(0,o.jsxs)(n.p,{children:["This was a quick start but if you want to learn more tips or to participate with other iOS pythonistas, join our ",(0,o.jsx)(n.a,{href:"https://github.com/blinksh/blink/discussions/1725",children:"discussion"}),"."]})]})}function p(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=Object.assign({},(0,c.ah)(),e.components),t=n.wrapper;return t?(0,o.jsx)(t,(0,a.Z)((0,s.Z)({},e),{children:(0,o.jsx)(h,(0,s.Z)({},e))})):h(e)}var u={filename:"python_flask.md",route:"/build-up/python_flask",meta:{},pageMap:[{name:"advanced",children:[{name:"advanced-mosh",route:"/advanced/advanced-mosh",locale:"",frontMatter:{id:"advanced-mosh",sidebar_position:2,sidebar_label:"Mosh",slug:"/advanced/advanced-mosh"}},{name:"advanced-ssh",route:"/advanced/advanced-ssh",locale:"",frontMatter:{id:"advanced-ssh",sidebar_position:1,sidebar_label:"SSH",slug:"/advanced/advanced-ssh"}},{name:"bookmarks",route:"/advanced/bookmarks",locale:""},{name:"code",route:"/advanced/code",locale:""},{name:"creating-fonts-and-themes",route:"/advanced/creating-fonts-and-themes",locale:""},{name:"files-app",route:"/advanced/files-app",locale:""},{name:"meta.json",locale:"",meta:{"advanced-ssh":"SSH",webauthn:"WebAuthn: Passkeys & Secure Keys","advanced-mosh":"Mosh","files-app":"Files.app",bookmarks:"Bookmarked Locations",vim:"Vim",code:"Code","unix-roundup":"UNIX Roundup",socks:"SOCKS","creating-fonts-and-themes":"Creating Fonts & Themes"}},{name:"socks",route:"/advanced/socks",locale:""},{name:"unix-roundup",route:"/advanced/unix-roundup",locale:""},{name:"vim",route:"/advanced/vim",locale:""},{name:"webauthn",route:"/advanced/webauthn",locale:""}],route:"/advanced"},{name:"basics",children:[{name:"commands",route:"/basics/commands",locale:""},{name:"customize",route:"/basics/customize",locale:""},{name:"hosts",route:"/basics/hosts",locale:""},{name:"meta.json",locale:"",meta:{hosts:"Hosts","ssh-keys":"SSH Keys",notifications:"Notifications",commands:"Commands",snips:"Snips",customize:"Customize","tips-and-tricks":"Tips & Tricks"}},{name:"notifications",route:"/basics/notifications",locale:""},{name:"snips",route:"/basics/snips",locale:""},{name:"ssh-keys",route:"/basics/ssh-keys",locale:""},{name:"tips-and-tricks",route:"/basics/tips-and-tricks",locale:""}],route:"/basics"},{name:"build",children:[{name:"cloud_disk",route:"/build/cloud_disk",locale:""},{name:"meta.json",locale:"",meta:{start:"Getting Started",cloud_disk:"Storage"}},{name:"start",route:"/build/start",locale:""}],route:"/build"},{name:"build-up",children:[{name:"code_server",route:"/build-up/code_server",locale:""},{name:"go",route:"/build-up/go",locale:""},{name:"meta.json",locale:"",meta:{code_server:"VS Code Server",go:"Go",nextjs:"Next.js",python_flask:"Python + Flask",rails:"Ruby on Rails",rust:"Rust"}},{name:"nextjs",route:"/build-up/nextjs",locale:""},{name:"python_flask",route:"/build-up/python_flask",locale:""},{name:"rails",route:"/build-up/rails",locale:""},{name:"rust",route:"/build-up/rust",locale:""}],route:"/build-up"},{name:"cloud-providers",children:[{name:"aws",route:"/cloud-providers/aws",locale:""},{name:"do",route:"/cloud-providers/do",locale:""},{name:"hetzner",route:"/cloud-providers/hetzner",locale:""},{name:"meta.json",locale:"",meta:{aws:"Amazon Web Services",do:"Digital Ocean",hetzner:"Hetzner"}}],route:"/cloud-providers"},{name:"faq",route:"/faq",locale:""},{name:"index",route:"/",locale:""},{name:"integrations",children:[{name:"meta.json",locale:"",meta:{"tailscale+mosh":{title:"Tailscale + Mosh"}}},{name:"tailscale+mosh",route:"/integrations/tailscale+mosh",locale:""}],route:"/integrations"},{name:"meta.json",locale:"",meta:{index:"Quick Start","what-is":"What is Blink Shell",basics:"Basics",advanced:"Advanced",integrations:{title:"Integrations"},"cloud-providers":"Cloud Providers",build:"Build","build-up":"Build Up","whats-new":"What's New?",faq:"FAQ",migration:"(Closed) Blink Shell 14"}},{name:"migration",route:"/migration",locale:""},{name:"what-is",route:"/what-is",locale:""},{name:"whats-new",route:"/whats-new",locale:""}],headings:[{type:"heading",depth:1,children:[{type:"text",value:"Build up Python + Flask projets",position:{start:{line:1,column:4,offset:3},end:{line:1,column:35,offset:34}}}],position:{start:{line:1,column:1,offset:0},end:{line:1,column:35,offset:34}},value:"Build up Python + Flask projets"},{type:"heading",depth:2,children:[{type:"text",value:"Developing",position:{start:{line:29,column:4,offset:642},end:{line:29,column:14,offset:652}}}],position:{start:{line:29,column:1,offset:639},end:{line:29,column:14,offset:652}},value:"Developing"},{type:"heading",depth:3,children:[{type:"text",value:"Opening Ports",position:{start:{line:51,column:
15,offset:1023},end:{line:51,column:18,offset:1036}}}],position:{start:{line:51,column:1,offset:1019},end:{line:51,column:18,offset:1036}},value:"Opening Ports"},{type:"heading",depth:2,children:[{type:"text",value:"Comments",position:{start:{line:63,column:4,offset:1417},end:{line:63,column:12,offset:1425}}}],position:{start:{line:63,column:1,offset:1414},end:{line:63,column:12,offset:1425}},value:"Comments"}],unstable_flexsearch:{codeblock:!1}};globalThis.__nextra_internal__={pageMap:u.pageMap,route:u.route};n.default=(0,i.ZP)("/build-up/python_flask",(function(e){return(0,o.jsx)(l.SSGContext.Provider,{value:e,children:(0,o.jsx)(p,{})})}),(0,s.Z)({title:u.meta.title||d},u),r.Z)}},function(e){e.O(0,[295,774,888,179],(function(){return n=7677,e(e.s=n);var n}));var n=e.O();_N_E=n}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.